简体   繁体   English

基于主机和uri的Apache重定向

[英]Apache redirect based on host and uri

I have a fairly simple redirect rule setup in my Apache vhost . 我在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>

I want to add another condition based on the request uri. 我想基于请求uri添加另一个条件。 The redirect above should not be performed if the request uri equals google.html . 如果请求uri等于google.html ,则不应执行上述重定向。 I guess another rewrite condition is needed based on the request uri variable. 我猜想基于请求uri变量需要另一个重写条件。 Any ideas on how the regex should look like? 关于regex外观有什么想法吗?

应该看起来像这样:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM