Skip to content Skip to sidebar Skip to footer

How To Block Direct Access To .html Files? (.htaccess)

I want to block direct access to multiple files, but being able to access in index.html For example: I want to block access to all the files located in 'http://www.mywebsite.com/pa

Solution 1:

Try this : redirect on index.html instead of notfound.html

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^http://www.mywebsite.com/index.html
RewriteRule .*\.html$ index.html
RewriteCond %{HTTP_REFERER} ^http://www.mywebsite.com/index.html
RewriteRule (.*)\.html$ $1.html

In images directory in other .htaccess :

options -indexes
ErrorDocument 403 http://www.mywebsite.com/index.html

But why do you wish to do this? ;)

Post a Comment for "How To Block Direct Access To .html Files? (.htaccess)"