Skip to content


Apache: Using htaccess to restrict access to a file

As well as being able to restrict access to directories, you can restrict access to specific files using htaccess files in Apache.

For example, to protect “secret.php” using basic auth:

AuthType Basic
AuthName "Authorised users only"
AuthUserFile /path/to/user/file
AuthGroupFile /path/to/group/file
<files secret.php>
Require user xxxx

Posted in Uncategorized.

Tagged with .

5 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. WP Themes says

    Good brief and this enter helped me alot in my college assignement. Say thank you you for your information.

  2. college scholarships says

    Great, I never knew this, thanks.

  3. unsecured loans says

    Excellent blog! I genuinely love how it’ s easy on my eyes and also the details are well written. I am wondering how I could be notified whenever a new post has been made. I have subscribed to your rss feed which should do the trick! Have a nice day!

  4. Debt Consolidation says

    Sorry for my bad english. Thank you so much for your good post. Your post helped me in my college assignment, If you can provide me more details please email me.

  5. excernsor says

    Hi man.