Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   .htaccess (http://www.greenguysboard.com/board/showthread.php?t=1301)

Tino 2003-10-05 05:24 AM

.htaccess
 
I have a .htaccess file set up to prevent hotlinking from certain domains. At first I set it up to disallow from only 1 domain(mysmutsearch) and it worked fine:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)?mysmutsearch.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://neighbourhoodgirls.com/ggg.jpg [R,NC]

But when I add more domains to the list, it dont work anymore. Not even the domain that I blocked in first code.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www\.)?mysmutsearch.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?fusker.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?chatropolis.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://neighbourhoodgirls.com/ggg.jpg [R,NC]

Anyone know what im doing wrong?

Cleo 2003-10-05 07:48 AM

Maybe your editor is adding something in there.

I don't use wildcards when I write mine. Here is what one of mine looks like.
http://cleogoodstuff.com/htaccess.txt

Tino 2003-10-05 09:22 PM

Thanks Cleo. I need the opposite effect though, my script should not tell which domains can hotlink. It should tell which domains that cannot hotlink.

Cleo 2003-10-05 09:39 PM

I never seen htaccess used that way so I'm afraid I have no idea then.

Wouldn't it be a lot easier just to say which are good domains to hotlink?

Tino 2003-10-05 09:50 PM

Well - the traffic I have right now makes that impossible. I got perhaps 500 domains that I need to allow hotlinking from me, I only got 3 that cant, so....

Its kind of odd that my first file worked fine, but as soon as I add more than 1 domain to the list- it dont work anymore.

Tino 2003-10-05 10:51 PM

I figured it out. This did the trick:

Options +FollowSymlinks
RewriteEngine on


RewriteCond %{HTTP_REFERER} ^http://(www\.)?fusker.com(/)?.*$ [OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?mysmutsearch.com(/)?.*$ [OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?chatropolis.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://neighbourhoodgirls.com/ggg.jpg [R,NC]


But thanks anyway Cleo:-)

Cleo 2003-10-05 10:58 PM

That makes sense, but now I'm wondering why my htaccess does not need [OR] after each line.

Sometimes I think that htaccess is part black magic. lol

Tino 2003-10-05 11:03 PM

Small corrections- just in case anyone should need a thing like this. It has to be:

Options +FollowSymlinks
RewriteEngine on


RewriteCond %{HTTP_REFERER} ^http://(www\.)?fusker.com(/)?.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?mysmutsearch.com(/)?.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?chatropolis.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://neighbourhoodgirls.com/ggg.jpg [R,NC]


Not really sure how importent that [NC] flag is, but...

Ya, it really is odd Cleo. Thats why I couldnt figure out why my first one didnt work, cause the opposite worked fine.

urb 2003-10-06 09:58 AM

I am wondering about HTTP_REFERER being blocked by products such as Norton Internet Security.

If you buy and install a straight version of NIS, you will find that sites protected by .htaccess will not show any images at all. All you will see is placeholders.

Your average punter will not have even heard of ZoneAlarm and will just visit a store to buy Norton or other brands which seem to be adding Ad-block and Privacy stuff.

I am also wondering how much market share Norton has (and products of similar Privacy control).

But what is really scary is the thought of cookies being blocked, especially CCBill cookies.


All times are GMT -4. The time now is 05:17 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc