shotdsherrif shotdsherrif - 1 month ago 7
Apache Configuration Question

WAMP Apache rewrite issue in .htaccess

I am working in a WAMP environment trying to create a bare bones front controller and have started with creating an .htaccess file in my project root (i.e. www/molecule/ The .htaccess contains:

Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php


Apache rewrite_module is enabled in my WAMP settings, and also uncommented in the httpd.conf, but getting an Internal Server Error when I try to load any pages with that .htaccess in the directory. The Apache Error log reads:

[alert] [client 127.0.0.1] C:/wamp/www/molecule/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration


Can someone point me in the right direction?

Answer

It looks like you didn't turn on your mod_rewrite module. Find your httpd.conf file and do a search for mod_rewrite, the line should look something like this:

LoadModule rewrite_module modules/mod_rewrite.so

Make sure you uncomment that by removing the # in front of it.