When attempting to use mod_rewrite in a .htaccess file fails, try these steps.

  1. Stop! Don't use htaccess files for mod_rewrite unless you have no other choice. Doing so is slow and confusing.
  2. Put a nonsense line (such as Wooga) in your htaccess file and try the request again. If you don't see a 500 Internal Server Error message, your htaccess file is being ignored altogether. The solution is to set both AllowOverride FileInfo and Options FollowSymlinks in httpd.conf for the directory in question. However, if you are able to make that change, see step one.
  3. If you think your rules look ok but you still see a 500 Internal Server Error message, make sure mod_rewrite is loaded in the server.
  4. If you have ensured that mod_rewrite is loaded, and that RewriteRule is enabled for htaccess files, it could be that your rules are looping.
  5. If none of the above steps help, try a very simple rewrite to check if the module is enabled. For example:
RewriteEngine On
# Redirect all requests to example.com
RewriteRule ^ http://example.com/
  • No labels