Web Hosting Talk







View Full Version : .htaccess hotlinking prevention, prevent EVEN typed urls?


athlonkmf
05-17-2004, 09:34 AM
Don't you hate it if you've managed to do something but broke it because you've accidently removed it?

Well, happened to me.

I had a .htaccess with a rule that ONLY if a file is directed from a certain referrer, it can be accessed. EVEN if you copy and paste the link in a browser and then type it, it'll show a hotlinking-image.

But now I can't do it again... anyone got any pointers on how to set up .htaccess to even prevent directly typed URLs?

SimplyDiff
05-17-2004, 11:48 AM
What .htaccess code are you trying to use?

If it's a rewrite, then usually it has something like (not exact syntax)

RewriteRule !^$

That says if there is no referer then let them pass. If you remove that, then that should stop typing the link directly.

Be warned, most privacy blockers, some firewalls, and even web browsers with the correct settings will block the referrer from being sent. Therefore you could be blocking real traffic.