apache redirect based on referrer

Posted by user40259 on Server Fault See other posts from Server Fault or by user40259
Published on 2010-04-11T00:19:20Z Indexed on 2010/04/11 0:23 UTC
Read the original article Hit count: 592

Filed under:
|
|

I've just noticed that schoolmate.r09.railsrumble.com seems to be doing a rewrite to one of my domains, agilegrad.com. This is kind of annoying since that site is the top hit on google when searching for my domain and the address bar stays as schoolmate.r09.railsrumble.com when following the link.

I'd like to redirect incoming requests with schoolmate.r09.railsrumble.com in the referrer variable to agilegrad.com, but the following in my vhost config for agilegrad.com isn't working for me:

RewriteEngine on
RewriteCond %{HTTP_REFERER} railsrumble
RewriteRule ^/(.*) http://www.agilegrad.com/$1 [L,R=301]

With this on, I see a bunch of redirects in my access log, but only for static files (cs, javascript). This is the first time I've tried using mod_rewrite, so I'm not even sure if I can accomplish what I want, which is to do a full redirect to my domain and have it appear to the user that they are at agilegrad.com.

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite