Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

As I answered here, I've solved this by simply creating an 401.html file for 401 errors.

share|improve this answer

in html/exported/.htaccess

RewriteEngine off
share|improve this answer
well if that doesn't win the thread necropsy award. Where was the latest activity? – karmawhore Jun 30 '10 at 5:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.