Chris Ruzin - 14 February 2007 11:13 PM
I edited my .htaccess file and added the following:
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx
RewriteCond %{QUERY_STRING} !(^|&)coral-no-serve$
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?digg\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?slashdot\.org [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?slashdot\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?fark\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?somethingawful\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?kuro5hin\.org [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?engadget\.com [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?boingboing\.net [OR]
RewriteCond %{HTTP_REFERER} ^http://([^/]+\.)?del\.icio\.us
RewriteRule ^(.*)?$ http://YOURDOMAIN.COM.nyud.net:8080/$1 [R,L]
It’s easy enough to add other sites you want to redirect. Not sure if that’s what you’re looking for, but it works great for me.
Chris, this is great work. Can you explain some of what it does (besides the obvious redirect) for those of us still learning the intracacies of mod_rewrite? For example, I don’t fully understand this part of the string:
RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx
RewriteCond %{QUERY_STRING} !(^|&)coral-no-serve$
And this one (the reference to port 8080):
RewriteRule ^(.*)?$ http://YOURDOMAIN.COM.nyud.net:8080/$1 [R,L]
Thanks.