.htaccess中的WAMP Apache重写问题 [英] WAMP Apache rewrite issue in .htaccess
问题描述
我正在WAMP环境中尝试创建裸露的前端控制器,并开始在项目根目录中创建.htaccess文件(即www/molecule/.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
在我的WAMP设置中启用了Apache rewrite_module,并且在httpd.conf中也未添加注释,但是当我尝试在目录中加载带有该.htaccess的任何页面时,出现内部服务器错误. Apache错误日志显示为:
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?
推荐答案
似乎您没有打开mod_rewrite模块.找到您的httpd.conf文件并搜索mod_rewrite
,该行应如下所示:
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.
这篇关于.htaccess中的WAMP Apache重写问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!