Question: 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?

Answer: 
As I [answered here](https://stackoverflow.com/questions/1641666/htaccess-rewrite-and-auth-conflict/4977249#4977249), I've solved this by simply creating an 401.html file for 401 errors.
in html/exported/.htaccess

```
RewriteEngine off

```