Replies: 1
Hi All, new to WordPress but doing well with it.
I was editing .htaccess via the Hardening WordPress Codex and encountered a problem with one line:
RewriteRule !^wp-includes/ – [S=3]
This completely breaks my web server (on a shared hosting plan) – I get:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@authormartinr.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
It is part of the block of code for protecting the includes:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ – [F,L]
RewriteRule !^wp-includes/ – [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ – [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php – [F,L]
RewriteRule ^wp-includes/theme-compat/ – [F,L]
</IfModule>
If I comment out the line then all is well – e.g.:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ – [F,L]
#RewriteRule !^wp-includes/ – [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ – [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php – [F,L]
RewriteRule ^wp-includes/theme-compat/ – [F,L]
</IfModule>
So I ran the code through the syntax checker at htaccesscheck . com and it gave a fatal error for that line:
Fatal: Invalid command ‘RewriteRule !^wp-includes/’ perhaps mis-spelled or defined by a module not included in the server configuration
I don’t understand what the line actually does, or how to further troubleshoot this – any help would be appreciated!
Thanks and have a great day.