On my Apache server I have this rules:

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule (.*) /shindig/index.php [L]
</IfModule>

This redirects every request to /shindig/index.php, I want to redirect every request except those for anything in this path: /myOrigPath

How can I do this? Please assume that I have almost no knowledge of mod_rewrite

Thank you

Accepted Answer

You can use another RewriteCond and exclude that path:

RewriteCond %{REQUEST_URI} !^/myOrigPath
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /shindig/index.php [L]

You could also check the matched value of your RewriteRule pattern instead of %{REQUEST_URI} with either $0 (whole match) or $1 (match of the first group).

Written by Gumbo
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki