PDA

View Full Version : Redirecting Scrapers with Mod_Rewrite and .htaccess file


grungee
11-01-2007, 19:48/07:48PM
If I use the following code it works for the first instance I put in the .htaccess file but when I go to add it again for another scraper it doesn't work any more

RewriteCond %{REMOTE_ADDR} ^123.456.78.9
RewriteCond %{HTTP_HOST} !123\.456\.78\.9+
RewriteRule /* http://www.scrapersite.com/ [R,L]


Any ideas why it only works if I put it in the file once?

I know I can just ban scrapers and idiots and bots but I like the idea of being able to send them back to there own sites.

WebSavvy
11-01-2007, 21:29/09:29PM
Tony are they leaving a user-agent string that you're able to identify?

If so, you could use this code that Dan0 once posted for me for Ranking Manager (it works really well too!)


RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Ranking-Manager.*
RewriteRule ^(.*)$ http://www.rankingmanager.com/ [R=permanent,L]


Change the user-agent and the domain, of course.

grungee
11-01-2007, 22:46/10:46PM
Thanks Deb but they are using the standard Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
and I can't ban that.

The code works but only for the first instance of it if I put 2 in the second one won't work.