PDA

View Full Version : Hotlink protection example


akc42
06-14-2008, 09:27 AM
When you go in to the hotlink protection area of cpanel, there is some text at the top about how it works and suggesting that you might like to specify image files and others that would fail to hotlink, and to separate them by commas

But the line "Block direct access for these extensions (separate by commas):" has the following in it

[^/]+\.htm

Which looks like some gobledegook regular expression that is pretty useless as an example, and it is not clear to me why its there (other than to confuse the nieive). Can someone post an example of how to block links to (say) .avi .mp4 and .jpg files.

Eriksrocks
06-14-2008, 11:50 AM
Don't know. I've never messed with hotlink protection, and so when I just went in there for the first time, it's disabled but that line has this for me:

jpg,jpeg,gif,png,bmp

I don't think it will even take regular expressions. I would just delete that put in whatever you want if I were you. :)

So, to block links to .avi, .mp4, and .jpg files, you would just do:

avi,mp4,jpg

Does that help? :)

Early Out
06-14-2008, 01:21 PM
When you go in to the hotlink protection area of cpanel, there is some text at the top about how it works and suggesting that you might like to specify image files and others that would fail to hotlink, and to separate them by commas

But the line "Block direct access for these extensions (separate by commas):" has the following in it

[^/]+\.htm

Which looks like some gobledegook regular expression that is pretty useless as an example, and it is not clear to me why its there (other than to confuse the nieive). Can someone post an example of how to block links to (say) .avi .mp4 and .jpg files.You're confusing two different things. To protect your files, just list the file extensions you want to protect, separated by commas.

The line about blocking direct access is talking about the referring pages. It's saying "don't allow hotlinking from .htm or .html files."

akc42
06-16-2008, 05:24 AM
You're confusing two different things. To protect your files, just list the file extensions you want to protect, separated by commas.

The line about blocking direct access is talking about the referring pages. It's saying "don't allow hotlinking from .htm or .html files."
Thanks - I understand what you are saying now.

I did try something - which was wrong - but in the process, I found out what happens. It creates a .htaccess file with rewrite clauses in it for the place you are protecting - and I can understand what to do better by reading the apache manual.

Thanks