htaccess rewrite and auth conflict

Posted by Michael on Server Fault See other posts from Server Fault or by Michael
Published on 2009-10-13T00:33:32Z Indexed on 2011/11/12 9:58 UTC
Read the original article Hit count: 346

Filed under:
|

I have 2 directories each with a .htaccess file:

html/.htaccess - There is a rewrite in this file to send almost everything to url.php

RewriteCond %{REQUEST_URI} !(exported/?|\.(php|gif|jpe?g|png|css|js|pdf|doc|xml|ico))$
RewriteRule (.*)$ /url.php [L]

and html/exported/.htaccess

AuthType Basic
AuthName "exported"
AuthUserFile "/home/siteuser/.htpasswd"
require valid-user

If I remove html/exported/.htaccess the rewriting works fine and the exported directory can be access. If I remove html/.htaccess the authentication works fine.

However when I have both .htaccess files exported/ is being rewritten to /url.php. Any ideas how I can prevent it?

© Server Fault or respective owner

Related posts about mod-rewrite

Related posts about .htaccess