Search code examples
apache.htaccessmod-rewriteinternal-server-error

Error 500 with .htaccess edits but mod_rewrite is loaded


as of title, I'm having problems with my .htaccess file, everything should be set fine, but has I write something as basic as

RewriteEngine on

it starts giving me that nice 500 Internal Server Error. I'm hosting on localhost on an Apache server (UNIX)

Obviously I triple checked that everything is set fine, and top of all that mod_rewrite is loaded.

Thanks for your precious help!


Solution

  • If the error occurs for every single type of instruction you put in the file (that is, caching, FilesMatch, ErrorDocument, etc), there are two possible options that I can think of right now:

    1. The encoding of your .htaccess file is not compatible with the server you're running. Try converting it to ANSI, and then try again (Apache does not support Byte Order Marks, so you'd need to save it to ANSI, or UTF-8, without the BOM). If that does not work:

    2. AllowOverride is not set correctly, or not at all. If you have access to the Virtual Host/Directory configuration, you'll need to enable it by adding the line AllowOverride All in the <Directory> container.