Forum Moderators: phranque
someboyd posted this one but gives 500 internal server error so I'd prefer a fresh one, if tested, better!
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?myspace\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?blogspot\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?livejournal\.com/ [NC]
RewriteRule .*\.(jpe?g¦gif¦bmp¦png)$ /images/nohotlink.jpe [L]
Replacing inline linked images with another image is generally not a sound decision.
A better practice is simply to deny.
I use the following:
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^http://(www\.)?MyDomian\.(com¦net) [NC]
RewriteRule \.(jpg¦gif¦pdf¦ico)$ - [NC,F]
[edited by: jdMorgan at 12:58 am (utc) on Feb. 9, 2008]
[edit reason] Just a formatting fix [/edit]
Another vote here for the "Live HTTP Headers" add-on for Firefox/Mozilla browsers. If you write mod_rewrite code and don't already use it, then you're either wasting a lot of time, or you're not testing thoroughly enough. I plug it so hard that some accuse me of having an ulterior motive... Nope, I just use it two/three hours every day.
Also nice for checking out the competition's server setup, BTW... ;)
Jim