简体   繁体   中英

Apache redirect based on host and uri

I have a fairly simple redirect rule setup in my 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. The redirect above should not be performed if the request uri equals google.html . I guess another rewrite condition is needed based on the request uri variable. Any ideas on how the regex should look like?

应该看起来像这样:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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