PDA

View Full Version : .htaccess File Help


lufbra
August 12th, 2006, 04:34 AM
On the webserver that I use, there's a .htaccess file added that basically stops folks from "hot linking" images from my webspace. Is there any way possible to have a directory created that will allow hot linking (say the directory is name "images"), and if so, what wouuld the .htaccess need adding to it? I've included the .htaccess file text....

# -FrontPage-

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.daves-pub.com
AuthUserFile /*****/*****/public_html/_vti_pvt/service.pwd
AuthGroupFile /*****/*****/public_html/_vti_pvt/service.grp

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.daves-pub.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.daves-pub.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.daves-pub.com [NC]
RewriteRule .*\.(gif|GIF|jpg|JPG)$ http://www.daves-pub.com/files/error.gif [R]

oracle128
August 12th, 2006, 05:13 AM
.htaccess supports overriding; that is, a .htaccess rule in a sub-directory will override any other rules specified higher up in the rules hierarchy. So, you simply need to write a .htaccess file which specifically allows hotlinking, and places it in the /images directory. You can allow hotlinking with this code:
RewriteEngine on
RewriteRule ^.*$ -

degsy
August 12th, 2006, 02:42 PM
If you are only adding a .htaccess file in the sub folder to allow hotlinking and not performing any other rewrite commands then you aonly need one line.


RewriteEngine off

lufbra
August 13th, 2006, 01:22 AM
http://www.daves-pub.com/graphics/pubaffiliate.gif

Let's see if Degsy's suggestion works.

lufbra
August 13th, 2006, 01:23 AM
http://www.daves-pub.com/forums/style_images/pubcurved/logo4.gif

Testing image with .htaccess file stopping hot linking.

lufbra
August 13th, 2006, 01:24 AM
Thanks Degsy and Oracle, it's working fine now. :)