Allow Public Access To a File in a Protected Directory Using .htaccess

Allow public Access To a File in a Protected Directory using .htaccess

Due to the many files that a website may have, not every file is accessible to all users or visitors of a website due to the structure of the website. With the help of .htaccess hiding some specific files in certain folders and also restricting their movement or accessibility is possible. However some files need not be hidden from the website users and hence they can be left for public access.

Procedures to showing a file in a protected directory

  • Login to your Cpanel
  • Click on file manager to open
  • Ensure the hidden files in the settings is checked
  • When in the right folder that is password protected, highlight its .htaccess file and edit from the top
  • The security code will be seen from inside the text editor reading as ( Auth Userfile”/home /userna5/.htpasswds/public-html/test/passwd”,  Auth type basic, required-valid user)-valid user).
  • From here to make the file and any other file accessible to the public add code

    (satisfy any

Allow from all)

  • Click save to make it activated and allow the file be accessible

Was this article helpful?

Related Articles

Leave A Comment?