RewriteCond Exclude a folder

I need to exclude rewriterules for some folders. In code below it calls the right parameters. If i call another folder like admin or images than apache returns error  "MaxRedirects option has been removed in favor of the global LimitInternalRecursion directive and will be ignored".

RewriteRule ^([a-z]+)-([a-z]+)/index.html$ index.php?lang=$1&country=$2

Open in new window

LVL 9
tolgaongAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ravenplCommented:
Not clear what You want (at least to me), but do You want the following?

#assumin .htaccess usage, otherwise should look like !^/admin/
RewriteCond %{REQUEST_URI} !^admin/
RewriteCond %{REQUEST_URI} !^images/
RewriteRule ...
0
ravenplCommented:
Or maybe

#only if matched pattern is non-existent directory
RewriteCond $1-$2 !-d
RewriteRule ^([a-z]+)-([a-z]+)/index.html$ index.php?lang=$1&country=$2
0
tolgaongAuthor Commented:
Thanks ravenpl but it does not work in my local test server...

It gives me the same error... I wrote the .htaccess file below.  I want to exclude the folders "admin, images, scripts and styles"

Do you have any idea for the situation?

Thanks in advance

Options +FollowSymlinks
 
RewriteEngine On 
RewriteOptions MaxRedirects=10
 
RewriteCond %{REQUEST_URI} !^/admin/ [OR]
RewriteCond %{REQUEST_URI} !^/images/ [OR]
RewriteCond %{REQUEST_URI} !^/scripts/ [OR]
RewriteCond %{REQUEST_URI} !^/styles/
 
RewriteRule ^(catchpa).(jpg|gif|png)$ images/scripts/catchpa.php?show=$1&type=$2 
RewriteRule ^([a-z]{2})-([a-z]{2,4})/index.htm[l]?$ index.php?pagelang=$1&pagecountry=$2 
RewriteRule ^([a-z]{2})/([a-z_]+).htm[l]?$ index.php?pagelang=$1&show=$2 
RewriteRule ^([a-z]{2})/([a-z_]+).htm[l]?~(.+)$ index.php?pagelang=$1&show=$2&$3 
RewriteRule ^([a-z]{2})-([a-z]{2,4})/([a-z_]+).htm[l]?$ index.php?pagelang=$1&pagecountry=$2&show=$3 
RewriteRule ^([a-z]{2})-([a-z]{2,4})/([a-z_]+).htm[l]?~(.+)$ index.php?pagelang=$1&pagecountry=$2&show=$3&$4

Open in new window

0
ravenplCommented:
if matched in .htaccess, You need to remove the leading slash from match, eg.

RewriteCond %{REQUEST_URI} !^admin/

Since You match negative, don't use [OR]. NOT A OR NOT B always fires, right?

each rewriteRule need separate set of rewriteConds
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.