开发者

Apache redirect based on host and uri

开发者 https://www.devze.com 2023-01-02 22:51 出处:网络
I have a fairly simple redirect rule setup in my Apache vhost. <VirtualHost *:80> ServerName mobile.foo.com

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_开发者_如何学PythonHOST} ^(.*)\.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?


Should look like this:

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

精彩评论

暂无评论...
验证码 换一张
取 消