After transferring my website from localhost on my host server and changing the theme to a newer one.

Performing any action including saving settings, installing plugin, saving plugins settings page and basically any saving action which is related to wordpress api will redirect me to home page.

I have tried to disable all plugins and even change to default theme but the issue still persists.

I also, did some research and a .htaccess code was suggested to be added on and it didn't work either. the code is as follow:

<IfModule mod_security.c>
   SecFilterEngine Off
   SecFilterScanPOST Off

I performed security scan using cpanel anti virus as well as wordfence scanner and still no luck.

My final though was maybe a wordpress core file was corrupted therefore, all files in wp-admin and wp-includes and also root files were replaced.

I am currently using PHP 7.2.

Any suggestion? It is driving me crazy

  • What's in your .htaccess file? Maybe try hard flushing rewrite rules. There are some examples here: codex.wordpress.org/Function_Reference/… Commented Jun 23, 2019 at 8:18
  • Default wordpress rewriting rules
    – MeMo
    Commented Jun 23, 2019 at 9:16
  • used function mmt_flush_rewrite_rules() {flush_rewrite_rules();} add_action( 'init', 'mmt_flush_rewrite_rules' ); didn't work
    – MeMo
    Commented Jun 23, 2019 at 9:19

1 Answer 1


After Spending many hours on this seemingly insoluble problem, as it turned out the issue was generated from mod security being enabled.

Although, I disabled it myself from cpanel, it had to be turned off from server and a level deeper in hosting as well.

So if you encountered this knot contact your web host in order to disable mode security.

I have also heard that turning this feature off is going to endanger my website and an extra layer of security will be lost, any suggestion about the way to sustain mod security as well as not getting involved with the prime issue?

  • Configuring mod_security is off-topic, but I agree that this should be the actual road to go. So instead of letting your hosting provider disable it, let them fix it.
    – leymannx
    Commented Jun 23, 2019 at 10:53
  • Thanks for your comment, will do.
    – MeMo
    Commented Jun 23, 2019 at 10:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.