4

我遇到了 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/)。

帮助 :(

4

2 回答 2

2

httpd.conf中,您是否有以下

#LoadModule rewrite_module modules/mod_rewrite.so

如果是,请删除#.

也许您必须为本地应用程序创建一个带有别名的虚拟主机。

在这种情况下,请点击此处的链接。

也许您已经有一个需要禁用的虚拟主机和别名。签入您的文件(hosts 文件、conf 文件等)

于 2015-02-02T13:22:51.233 回答
0

不要使用 Windows 资源管理器创建 htaccess 文件。您应该在记事本中创建一个新文件并另存为 .htaccess

于 2017-02-01T06:55:51.290 回答