.htaccess - URL 重写在 Wamp 服务器上不起作用

标签 .htaccess url url-rewriting rewriting

我在 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/

相关文章:

java - liferay 6.1 中的友好 URL

apache - Rewriterule 从旧论坛永久移至新论坛

php - htaccess URL 重写在 PHP Slim 框架中不起作用

.htaccess - 从 http 重定向到 https 是否有加密

php - Laravel 5 中 URL 中的主题标签

linux - 网址重写-隐藏文件夹结构

Apache regex -301 重定向以消除 url 路径中的重复项

python - url国际化应该怎么做?

c# - 单击富文本框中的链接后如何打开新的浏览器窗口(C#)

php - 将所有内容传递到一个位置 nginx