[TriLUG] apache redirect
Brian Bell
bbell at kneecap.net
Thu Jan 19 21:37:33 EST 2006
What about ...
<VirtualHost *:80>
ServerAlias *.foo.com
RewriteEngine On
RewriteCond %{HTTP_HOST} .*.foo.com [NC]
RewriteCond %{REQUEST_URI} !/somedir/(.*)$ [NC]
RewriteRule ^/(.*)$ http://bar.com/$1 [L]
</VirtualHost>
I think this should go something like...
Condition = rewrite if HTTP_HOST is a foo.com domain (case-insensitive)
Condition = do not rewrite if the REQUEST_URI is the directory you want
to exclude (case-insensitive)
Rewrite = any request to foo.com/{whatever was requested} to
http://bar.com/{send them there on bar.com}
Jason Tower wrote:
> i have a very simple rule in place that redirects all requests for
> foo.com to bar.com:
>
> <VirtualHost *:80>
> Redirect 301 / http://bar.com/
> ServerName foo.com
> </VirtualHost>
>
> i'd like to modify this so that requests for foo.com/somedir* are not
> redirected, but everything else is. i've tried a bunch of things
> using RedirectMatch but haven't quite gotten it to work. i think it's
> just my regexp that is incorrect, can anyone lend a hand?
--
Brian Bell
Kneecap Interactive
919-321-1365
bbell at kneecap.net
More information about the TriLUG
mailing list