Anagmate
Anagmate

Reputation: 1903

deny access to all subdirectories using htaccess

I have web structure like this:

root
    folder1
    folder2
    errors
    resouces
    ...
    index.php

and I want to deny access to all subdirectories exept errors. I don't want to have .htaccess in every single subdirectory, just one in root. Any tips?

Upvotes: 1

Views: 265

Answers (1)

Dennis Kriechel
Dennis Kriechel

Reputation: 3749

You can set an environment variable if the request contains a /errors, doing something like this in your htaccess file:

SetEnvIf Request_URI /errors iserrors=1
Order Deny,Allow
Deny from all
Allow from env=iserrors

Upvotes: 1

Related Questions