问题
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?
回答1:
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.
回答2:
if it is related to hosting site then ask to your hosting company or if you want to enable it in wamp local machine then check this youtube step by step tutorial related to enabling rewrite module in wamp apache
https://youtu.be/xIspOX9FuVU?t=1m43s
Wamp server icon -> Apache -> Apache Modules and check the rewrite module option
it should be checked but after that restart all services in wamp
来源:https://stackoverflow.com/questions/11091464/wamp-apache-rewrite-issue-in-htaccess