0

In a CentOS with Bash A WordPress plugin (most likely WordFence) changes my .htaccess file by deleting extraneous (Apache PCRE) directives I've added there, and I can't access httpd.conf to add them there instead, as that's a shared server environment, so I'm quite stuck.

By "extraneous directives" I meant to all directives I've manually added below:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

I didn't find a way to stop making WordFence do so.

Considered workarounds:

  1. Repeatedly (daily) re-creation of .htaccess from a local template by a cronjob.

  2. Repeatedly (daily) appending the extraneous parts of all .htaccess files from a template (via a complicated script).

Both solutions doesn't seem appealing.

My question

What is the correct solution from your understanding?

Maybe creating the file from an online, formal, WordPress template? Maybe something else?

  • 2
    1. Get rid of that plugin if it doesn't do what you want. 2. Remove write permission from the .htaccess file, so PHP can't change it. – fuxia Jun 17 '18 at 2:20
  • Why using a plugin (if it is the one mentioned by you) which helps you to do some (in this case it tries to help protecting your website) but you don't want to ADD needed code to function as pretend. This plugin is NOT deleting already existing code in .htaccess at all when added that code correctly. – Charles Jun 18 '18 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.