【问题标题】:Apache rewrite rules issueApache重写规则问题
【发布时间】:2013-10-19 23:56:11
【问题描述】:

以下是我的 apache conf 文件的内容。我期待以下行为:-

有人可以就我做错了什么提供反馈。据我了解 RewriteRule 是上下文感知的,这些应该按预期工作。

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/mylocalhost"
    ServerName www.mywebsite

    # Other directives here
    RewriteEngine   on
    RewriteRule ^/google$   http://www.google.com/ [R]  
</VirtualHost>

Alias /somecode "C:/somecodedir/"

<Directory "C:/somecodedir/">
    RewriteEngine   on
    RewriteRule ^/google$   http://www.yahoo.com/ [R]

    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
        Allow from all
</Directory> 

【问题讨论】:

  • 如果您在第二个 (^google) 中从 ^/google 中删除 /,这有帮助吗?
  • 不,那行不通。
  • .. 它应该...启用您的日志记录以查看它的作用(另请参阅我在答案中给出的关于 ^/ 不匹配任何内容的链接)。

标签: apache mod-rewrite


【解决方案1】:
猜你喜欢
  • 2014-09-26
  • 2012-07-12
  • 2017-02-05
  • 1970-01-01
  • 1970-01-01
  • 2012-01-05
  • 1970-01-01
  • 2011-09-02
相关资源
最近更新 更多