Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

htaccess -> deny access to wildcard subdirectories without using rewriterule

Status
Not open for further replies.

ThomasJSmart

Programmer
Sep 16, 2002
634
Is it possible to deny access to a subdirectory from a htaccess file in the root?

The exact structure is like this:

/root/.htaccess
/root/subdirs/sub1/noaccess
/root/subdirs/sub1/access
/root/subdirs/sub2/noaccess
/root/subdirs/sub2/access


the .htaccess on the root should disable access to the 2 "noaccess" directories.
something like: /subdirs/(.*)/noaccess -> deny all

i dont think i can use a rewrite rule because each "noaccess" directory contains a htaccess with rewrite rules already. (mainly this one: RewriteRule ^(.*)$ index.php [NC,L])


Possible?

Thank you
Thomas






site | / blog |
 
One of the easiest ways is to put a .htaccess file in any subdir where you do not want access. It allows you to specify which type of access/authentication that subdirectory and all its subs can have. You can put just about any directive in the file that you can put in apache's main config file. You can also have as many .htaccess files as you want.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top