|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
.htaccess protecting _only_ some dirs
I'm usinf apache with win32, I have the document root at c:/Pages/ and in the document root I have a .htaccess that works perfectly, asking for a password.
I have various dirs in c:/pages/. Example: -Dir01 -dir02 -dir03 (...) How can I configure .htaccess to protect only dir02 and dir03, and not dir01? I hope you can help me. Best Regards, Simao Mata |
|
#2
|
|||
|
|||
|
take it out of the htaccess path
|
|
#3
|
|||
|
|||
|
>> How can I configure .htaccess to protect only dir02 and dir03, and not dir01?
Just place your .htaccess in dir02 and dir03. Or you can configure a <Directory "/path/to/dir02"> and dir03, respectively. |
|
#4
|
|||
|
|||
|
But if I take .htaccess of the document root, the document root is no longer protected, I want the root to be protected.
In another hand, if I put .htaccess in the documentroot, all the dirs in it, will be protected. Regards, Simao Mata |
|
#5
|
|||
|
|||
|
>> the document root is no longer protected
In your first post you said you want to protect dir2 and dir3, not dir1 and you also didn't mention you want your docroot to be protected as well. So why don't you post one more time and tell us what directories exactly you want to protect? Also give us a docroot (with directory layout) would be helpful. |
|
#6
|
|||
|
|||
|
My document root is c:/pages/ I have dir01, dir02 and dir03 inside c:/pages/.
I want to protect dir02, dir03, and c:/pages/, and I want to leave dir01 unprotected. If I put a .htaccess file in the document root all the dirs will be protected, but I want to leave dir01 unprotected. Thanks for your help, Sorry for my lousy english. Regards, Simao Mata |
|
#7
|
|||
|
|||
|
Don't use .htaccess, configure it in httpd.conf like so:
<Directory "c:/pages"> AuthType Basic AuthName "Private Area" AuthUserFile c:/path/to/.htpasswd Require valid-user </Directory> <Directory "c:/pages/dir1"> Allow from all Satisfy any </Directory> |
|
#8
|
|||
|
|||
|
It works fine!
Thanks for your help. Regards, Simao Mata |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > .htaccess protecting _only_ some dirs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|