<p>I have this RewriteRule that works too well :-)</p>

<pre><code>RewriteRule ^([^/]*)/$ /script.html?id=$1 [L]
</code></pre>

<p>The bad thing about this rule is that it also matches physical directories which I don't want.</p>

<p>How can I tell the <code>mod_rewrite</code> to ignore physical directories and apply the above rule only when the directory matched does not exist?</p>

Take a look at
RewriteCond
. Put the following before your rule to exempt out directories and files
```
```
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
```
```