我遇到了 Wamp Server 和 URL 重写的问题。我已经使用他的.htaccess从生产服务器导入我的项目。URL 重写在生产环境中运行良好,但在 localhost 中却不行。
在我的 Wamp 配置中,rewrite_module已激活。在 httpd.conf 中:
<Directory "c:/wamp/www/">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - don't remove
# Require local
Allow from all
</Directory>
但是,在我的网站上,链接http://localhost/conditions返回 404 错误。我的 .htaccess :
Options +FollowSymlinks
RewriteEngine on
# Conditions
RewriteRule ^conditions pages/conditions.php [L]
所有文件都在 wamp 的根目录 (c:/wamp/www/)。
帮助 :(