0

One of my websites built on wordpress have 500 internal server error after every 2-3 weeks, and I have to delete .htaccess every time to fix this and a new htaccess appears after that.

The strange thing about the problem is the htaccess that appears after deletion is no different from the one which is deleted.

This is a bad version of htaccess which I have deleted to get it working.

# BEGIN WordPres
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
Azeem Akhter
  • 497
  • 7
  • 19
  • 3
    if you have access to logs, check them. – Funk Forty Niner Nov 20 '15 at 19:45
  • If deleting .htaccess fixes this, why do you have .htaccess in the first place? Is someone modifying your .htaccess file? – Eric J. Nov 20 '15 at 19:50
  • Inspect the .htaccess code to get some clues as to what's happening. You could post the parts that you suspect. – Scriptonomy Nov 20 '15 at 19:56
  • I have updated the question and have added the .htaccess content – Azeem Akhter Nov 20 '15 at 20:06
  • 2
    The content may be the same, but are the permissions the same before / after deletion? – Jeff Lambert Nov 20 '15 at 21:01
  • If you use pretty permalinks the .htaccess gets created automatically. There is nothing wrong with yours, except for the typo in the first comment (WordPres). You can verify that at https://codex.wordpress.org/htaccess. It beats me why the error resolves when removing that file though. – Axel Nov 20 '15 at 23:06

1 Answers1

1

It is obvious to me that whenever you get server error code 500, the file permissions of .htaccess have changed. When .htaccess is created again it has new default permissions. So you must verify & investigate what/who is changing .htaccess permissions.

Altin
  • 2,175
  • 3
  • 25
  • 47