View Full Version : .htaccess
BusterLee
10-19-2002, 05:06 PM
I am trying to utilise the .htaccess commands that stop bandwith theft...greedy mugs!!!
I have added the following code to the .htaccess however once uploaded it stops anyone accessing any page!!!!
Anyone with any ideas?
ErrorDocument 404 /404.html
ErrorDocument 401 /wronglogin.shtml
ErrorDocument 403 /403.shtml
ErrorDocument 500 /500.shtml
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?north-walsham.biz/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.north-walsham.biz/images/nolink.gif [R,L]
Spookster
10-19-2002, 08:34 PM
This will work
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
RewriteRule .*\.(gif|GIF|jpg|JPG)$ - [F]
You don't need all that extra gooblygock in your referrer condition. You may want to add in a few like any variations on your main domain such as I did above. Also might want to put in your IP address. Also in the rule for the file extensions you can put in caps as well as not caps in case you have any like that.
Oh also note this doesn't work with Netscape or Mozilla. Unfortuntately those browsers don't like to send referrer information along so if there is not referrer then they get blocked due to the first condition that looks for no referrer.
BusterLee
10-19-2002, 08:38 PM
Just to check though how I get it to display an image of my choice? the rewrite line i mean..... thanks by the way... will try now
Spookster
10-19-2002, 08:55 PM
Yes of course. forgot to put that back in there. Just tack on what you had before in the last line. Putting out an alternate image is always a fun way to get back at people hotlinking. Really disgusting and revolting images work well for that. lol
BusterLee
10-19-2002, 09:00 PM
Sorry but still having probs.... just tried it and I am still getting 403's
Cant see anything around it.!!!! CONFUSED!!!:( :(
It even says that an error was found trying to receive the 403 page defined.. yo uknow the normal 403 page when the replacement 403 is missing.....
It is fine when I remove the commands again....
I am losing hair!!!!
Spookster
10-19-2002, 09:05 PM
You probably don't want to tell it to go to a 403 page when you are trying to display an alternate image. 403 means that access to the file is forbidden but what you want is to just show the alternate image.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.