【问题标题】:Apache redirect based on host and uri基于主机和uri的Apache重定向
【发布时间】:2010-06-11 12:01:56
【问题描述】:

我的Apache vhost 中有一个相当简单的重定向规则设置。

<VirtualHost *:80>
    ServerName mobile.foo.com
    ServerAlias *.foo.com

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(.*)\.foo\.com$
    RewriteRule ^(.*)$ http://mobile.bar.com/foo [R=301,L]
</VirtualHost>

我想根据请求 uri 添加另一个条件。如果请求 uri 等于 google.html,则不应执行上述重定向。我想根据请求 uri 变量需要另一个重写条件。关于regex 应该是什么样子的任何想法?

【问题讨论】:

    标签: regex apache mod-rewrite redirect rewrite


    【解决方案1】:

    应该是这样的:

    RewriteCond %{REQUEST_URI} !^/google\.html$
    

    【讨论】:

      猜你喜欢
      • 2019-01-17
      • 2018-04-12
      • 1970-01-01
      • 2012-07-23
      • 2014-03-08
      • 1970-01-01
      • 1970-01-01
      • 2020-02-12
      • 1970-01-01
      相关资源
      最近更新 更多