...

View Full Version : Restrict directory access



invisible_geek
09-14-2010, 08:38 PM
hello everyone,
this must be fairly easy for you to resolve. I don't know much about .htaccess or RegEx.

I want to restrict users from accessing the directories. I tried this code "Deny from all". I can get an error message saying "You don't have the permission..." however, I also found out the images are disabled and I can't see themon the pages. Likewise, javascripts are not working either due to this code "deny from all".

I want to restrict access to directories but not the images.

Moreover, how do I add a 404 page.

Thank you in advance. Your help is much appreciated.

Cheers!

oracleguy
09-15-2010, 12:54 AM
So you want it so if they type just the directory into the browser it won't let them see all the files in it?

You do that in the .htaccess file with
Options -Indexes

If you do the deny from all as you found out, it blocks out everything from accessing the files in the folder.

invisible_geek
09-15-2010, 09:12 AM
Thank you very much. Got it! :)

One more question. How to rewrite all the .php files to .html?

Thank you OG.

oracleguy
09-15-2010, 10:58 PM
Thank you very much. Got it! :)

One more question. How to rewrite all the .php files to .html?

Thank you OG.


RewriteEngine on
RewriteRule ^(.+)\.html$ $1.php


Any reason you want to do that though?

invisible_geek
09-18-2010, 07:37 PM
Thanks again OG. I really appreciate. I believe search engines give more priority to html files. what's your take on this? please enlighten.

Thanks.

Tony M
09-21-2010, 05:46 PM
I think search engines index pages without differencing a .php from a .html ....:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum