我在 Wamp 服务器和 URL 重写方面遇到问题。 我已经使用他的 .htaccess 从生产服务器导入了我的项目。 URL 重写在生产环境中工作正常,但在本地主机中则不然。
在我的 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/) 中。
帮助:(
最佳答案
在 httpd.conf
中,您是否有以下行:
#LoadModule rewrite_module modules/mod_rewrite.so
如果是,请删除#
。
也许您必须创建一个带有本地应用程序别名的虚拟主机。
点击此链接 here在这种情况下。
也许您已经有需要禁用的虚拟主机和别名。检查您的文件(主机文件、conf 文件等...)。
关于.htaccess - URL 重写在 Wamp 服务器上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28278397/