简体   繁体   中英

Parent htaccess override subfolder htaccess

I have a Zend aplication that uses a hatccess and redirects everything to index.php, but now i need to use a password protect folder in one of the subfolder, but when i tried to acess the subfolder keep giving me 404 error.

here the zend htaccess in the public_html folder:

RewriteEngine On
 RewriteRule !\.(js|txt|ico|gif|GIF|jpg|JPG|png|PNG|css|swf|pdf|xml|XML|eot|svg|ttf|woff)$   index.php
 SetEnv APPLICATION_ENV "production"

here the subfolder htaccess:

RewriteEngine off
AuthType Basic
AuthName "*folder*"
AuthUserFile "/home/*user*/.htpasswds/public_html/*folder*/passwd"
require valid-user

i tried to add RewriteRule ^blog/ - [L] to the public_html folder as i see in: Overwrite rewrite-rule of htaccess in parent folder

but it didnt work. what is weird is that if i take the password part of the subfolder htaccess, the "rewriteEngine off" work and i got a list of the files in that folder.

Obs: the server is a apache 2.2.25, so rewriteOptions InheritBefore is not a options

Obs2: the folder and user is not like that on the actual htaccess that was just to hide the names.

Obs3: im a noob in server configurations :)

This usually works for me. Paste code in the parent htacesss underneath your RewriteRule

RewriteRule ^(blog)($|/) - [PT,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM