Filed Under: ModRewrite

Apache “Under Construction” with exceptions

2 December 2008 No Comment

Do you want to restrict access to certain folders only ?
Usually you will put a .htaccess into your main dir if your site should not be accesible to the public. That’s how you can easily avoid that it will get indexed by search engine spiders for example.

You would do it like this:

AuthType Basic
AuthName "Restricted Directory"
AuthUserFile /path/to/my/.htusers
Require valid-user

Then you just need a .htusers (google for htusers generator if you don’t know how to generate one) and people won’t be able to see your site content at all.

On the downside you can’t access any subdirectories! If you want to specify any exceptions simply put a .htaccess file into the folder and insert “Satisfy any” into it. Done! Now you can access the subdirectories but not the main directory.







Like our posts? Then subscribe via Mail:

Email:  

Similar Posts:

Socialize:

delicious stumbleupon

Leave your response!

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.com.