【问题标题】:URL Rewriting not work on Wamp ServerURL 重写在 Wamp 服务器上不起作用
【发布时间】:2015-04-01 10:30:33
【问题描述】:

我遇到了 Wamp 服务器和 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/)。

帮助:(

【问题讨论】:

  • 可能的拼写错误? RewriteRule ^conditions$ /pages/conditions.php [L]。我刚醒来,你知道的;)
  • 您的 .htaccess 在 C:/ 的什么位置?

标签: .htaccess url url-rewriting rewriting


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    httpd.conf 中,有没有

    #LoadModule rewrite_module modules/mod_rewrite.so
    

    如果是,请删除#

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

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

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

    【讨论】:

    • LoadModule rewrite_module modules/mod_rewrite.so 已取消注释。而且我没有虚拟主机。
    猜你喜欢
    • 2018-04-13
    • 2014-01-11
    • 2018-06-15
    • 1970-01-01
    • 2016-10-31
    • 1970-01-01
    • 1970-01-01
    • 2015-07-08
    • 1970-01-01
    相关资源
    最近更新 更多