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

时间:2015-02-02 13:04:25

标签: .htaccess url url-rewriting rewriting

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

帮助:(

2 个答案:

答案 0 :(得分:2)

httpd.conf中,您有,其中包含:

#LoadModule rewrite_module modules/mod_rewrite.so

如果是,请删除#

也许您必须使用本地应用程序的别名创建 虚拟主机。

在这种情况下请点击此链接here

也许您已经拥有了需要禁用的虚拟主机和别名。检入您的文件(托管文件,配置文件等......)

答案 1 :(得分:0)

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