Hotlink exceptions and .htaccess?

He has: 688 posts

Joined: Feb 2001

I used cPanel to automatically hotlink protect against my images being hotlinked on other domains. But I have some "link to me buttons" that I make available to anybody who wants to add them to their blogs and/or webpages. I know of a few people who actually use these graphic buttons so I added their domains to the hotlink exceptions list, but that's not a valid longterm solution.

I must admit now that I really have no idea what the magical .htaccess file actually does, but I was told that this is where my hotlink permissions were set via cPanel. Long story short, how do I prevent hotlinking of my images EXCEPT for the one folder I specify as okay?

Thanks.

Busy's picture

He has: 6,151 posts

Joined: May 2001

place the hotlink .htaccess file in the root folder (will stop from whole domain) but in the folder you want people to link from add a .htaccess file with permissions to all or blank.

I think cpanel places a .htaccess file in every folder

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

You might also check out this link, the .htaccess cheatsheet:

http://thejackol.com/htaccess-cheatsheet

I used it just last night on a project.

He has: 688 posts

Joined: Feb 2001

Thanks y'all. I got it working the way I needed. I like to come back and tell people how my problem was fixed, incase it may help others with the same issue.

In order to UN-hotlink a specific directory, I just created an .htaccess file in that directory with the following code:

RewriteEngine on
RewriteRule ^.*$ -
'
That's all. Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.