.htaccess - block access to all hidden folders except specific folder

517 views Asked by At

We have a .htaccess (which is based on the HTML5Boilerpate .htaccess) which contains a section which throws a 404 error for hidden folders.

<IfModule mod_rewrite.c>
  RewriteRule "(^|/)\." - [F]
</IfModule>

I would now like to allow access to a specific hidden folder. Is this the best way to accomplish this?

<IfModule mod_rewrite.c>
  RewriteCond %{REQUEST_URI} !/.hidden-folder-to-allow-access-to
  RewriteRule "(^|/)\." - [F]
</IfModule>

From what I can tell, the above RewriteCond seems to work, allowing access to the folder .hidden-folder-to-allow-access-to. Have I missed anything?

0

There are 0 answers