Need htaccess help!

Need htaccess help!

Posted by: mbif
Posted on: 2006-01-17 18:27:00

I'm trying to block one specific webpage from hotlinking something from my site. I don't want to block anything else, just this one guy. I've done it with other pages, but unfortunately, something is throwing a wrench into the works -- the URL (EXAMPLE.com/EXAMPLE.phtml?user=EXAMPLE) contains a question mark, and it's causing my entire site to crash when I upload the modified .htaccess

Is there any way I can get this to work?

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www.)?EXAMPLE.com/EXAMPLE.phtml?user=EXAMPLE*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www.)?EXAMPLE.com/EXAMPLE.phtml?user=EXAMPLE*$ [NC]
RewriteRule .(jpg|jpeg|gif|png|bmp)$ http://www.MYSITEHERE.net/images/nohotlink.gif [R,L]

Re: Need htaccess help!

Posted by: silkrooster
Posted on: 2006-01-17 20:48:00

I maybe much help as I am still learning htaccess stuff. But I did find out that chmod must equal 644 or all havoc will break loose.
Silk

Re: Need htaccess help!

Posted by: number-six
Posted on: 2006-01-17 20:52:00

try escaping the ? in the url, ie: ?

A ? has a specific symbolic meaning in regexps and you need to escape it if you want it to be treated literally.


Re: Need htaccess help!

Posted by: mbif
Posted on: 2006-01-17 21:25:00

Ahh, thank you. That did the trick!

(You're my new hero!) ;P

Re: Need htaccess help!

Posted by: scjessey
Posted on: 2006-01-18 03:24:00

There is a comprehensive article about this on the DreamHost wiki: Preventing image "hotlinking"

Re: Need htaccess help!

Posted by: mbif
Posted on: 2006-01-18 15:32:00

The Wiki didn't cover the issue I was having with the question mark. It's been sorted out now, anyway, and I thank you for taking the time to respond to my post. :)

Tags: phtmljpg jpeghtaccessunfortunatelyhotlinkingbmppngwebpageuploadimageshttp