
Jasmine
Administrator
Sep 15, 2002, 11:51 PM
Post #2 of 2
(5116 views)
|
Re: [James] Rewrite Rule to block specific referer?
[In reply to]
|
Can't Post
|
|
Have more fun than just making a broken image in ebay.com. Here's code that will put an image of your choosing in there instead.
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://(www\.)?ebay.com/.*$ RewriteRule \.(gif|jpg)$ /stopstealing.gif [NC] Or if you needed to deny multiple domains, you can use [url=http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteCond][OR]:
RewriteEngine on RewriteCond %{HTTP_REFERER} ^http://(www\.)?ebay.com/.*$ [OR] RewriteCond %{HTTP_REFERER} ^http://dummy.hypermart.com/.*$ RewriteRule \.(gif|jpg)$ /stopstealing.gif [NC] Note that the RewriteCond and RewriteRule uses regular expressions, and that the period means "any single character". So while the period between ebay and com will match as intended (because the way the rest of the expression is structured), it's important to realize that the . is actually a regular expression metacharacter that will match a single character. In this case, it'll match the period.
|