.htaccess for protecting a content for thief
By Romain Wednesday, March 14 2007 - 19:36 UTC - Tech - Permalink
By Romain Wednesday, March 14 2007 - 19:36 UTC - Tech - Permalink
This a really nothing to do with web application security, but a friend asked me how to protect a bunch of html files in a directory. He was looking for sessions based solutions but for this he would have to rename the html files in php or whatever and then, implement the protection... pretty boring!
I suggest him a really easy and not perfect solution: checking the referer when accessing the html files (this is the kind of protection as the images anti-thief):
# .htaccess
# -------
RewriteEngine on
RewriteCond %{HTTP_REFERER} !.*yousite.com/.* [NC]
RewriteRule ^(.*)$ /fail.html [NC]
You can find an example here.
PS: this could not be a valid solution for lots of application!
Last comments