script

Monday, January 21, 2013

Prevent files from being accessed by URL

Write below lines in .htaccess, It will then give message of forbidden

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(pdf|t3x|xps|JPG|t3x|exe|pdf|jpg|png|jpg|php|js)$ - [F]

No comments:

Post a Comment