3

Recently my wordpress site has been experiencing problems with all pages returning a 404 error.

I tracked this down to the fact the .htaccess file in my wordpress directory keeps disappearing.

When I go to the Permalinks page and re-save it, the .htaccess file appears again - only for it to be deleted a few minutes later.

Any idea what could be doing this? It's very frustrating!

3
  • 1
    afaik Wordpress isn't in the habit of deleting htaccess files, sounds more like a host who doesn't like hidden files - who are you hosting with? Dec 14, 2017 at 5:53
  • My wordpress is hosted on my own VPS. The .htaccess file seems to be deleted roughly an hour after re-creating it each time.
    – re0603
    Dec 14, 2017 at 8:38
  • Sounds like a cronjob doing it then. Try disabling all the plugins on site and see if it still occurs. Might be worthwhile checking your VPS for any unusual activity, I've seen weirder things from compromised WP installs. Dec 14, 2017 at 10:53

1 Answer 1

0

You can give the read-only rights to .htaccess to prevent it from the modifications or removal.

$cd <your website directory>
$chmod 400 .htaccess

Your Answer

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

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