Web Niraj
  • Facebook
  • Flickr
  • Github
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
Search the site...
  • Home
  • Blog
  • Using .htaccess to Access Password Protected Subdirectories without Password

Using .htaccess to Access Password Protected Subdirectories without Password

2

Following on from protecting directories using .htaccess, you may find that (in some cases), you want to access a subdirectory that is password protected without a password. For example, you want static files (javascript and css files, etc) to be accessible without a password so others can access those files too.

The easiest way to do this is using .htaccess again. However, this solution is easier than setting up the password protected directory in the first place.

All you have to do is create a new .htaccess file in the subdirectory you don’t want password protected and add one line to it:

Satisfy any

This will allow that subdirectory to be accessible without the password required to access the parent directory.

Apache, Security

2 comments on “Using .htaccess to Access Password Protected Subdirectories without Password”

  1. john sujith says:
    February 7, 2013 at 4:36 PM

    is this possible to protect sub-folders instead of root folder ?

    Reply
    • Niraj Shah says:
      February 13, 2013 at 11:29 AM

      Yes. You just need to put the .htaccess file inside of the sub-folder.

      Reply

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

PSN Profile

Tags

Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache API Application Backup Bug Command Line Cordova Example Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Flash Geolocation Google Nexus 5 Google Nexus One Hacking HTML5 Image Manipulation iOS iPhone JavaScript jQuery Laravel 5 Linux NodeJS Parse PDF PHP Plugin Portfolio Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins
© 2011-2022 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Privacy Policy