mod_rewrite conditions and rules

I'm trying to adjust a rewrite condition and rule so that in a particular situation the rule is not performed.  

Basically, the application I am working on has a rewrite that when the file is not found pushes the request_uri string into a page to work out what needs to be done.  This works great except that I have 2 exceptions to this rule.  The first is the path "/CFFormGateway" and the second is "/flashservices/gateway".  Neither of these exist, but I don't want to redirect when these paths are accessed, as they are handled by the application server (CFMX 7), rather than the web server.

I've tried a few variations, but I've either broken the redirection completely or not had any affect, so I thought I would see if anyone could help me out.

The rewrite I currently have in a .htaccess file is this :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z]{1}.*)?$ redirect.cfm?thisURI=%{REQUEST_URI} [QSA,L]

This will rewrite any 'not found' lowercase URIs into redirect.cfm, which means that /CFFormGateway will be ignored, but /flashservices/gateway is not ignored and is pushed to redirect.cfm, breaking my flash remoting.  How can I change this rewrite to stop this from happening?  

TIA

Mr Nil
LVL 10
Mr_NilAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

caterham_wwwCommented:
Use a cond. checking the value of request_uri

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/(CFFormGateway|flashservices/gateway)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z]{1}.*)?$ redirect.cfm?thisURI=%{REQUEST_URI} [QSA,L]


> This will rewrite any 'not found' lowercase URIs

no. Only, if the first char assuming /abc -> a is lowercase, the rewrite would take place. /aBcD would be substituted with redirect.cfm, too.
If you're looking for a complete lowercase match, use as RegEx

^[a-z/]+$
instead.

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
Mr_NilAuthor Commented:
> no. Only, if the first char assuming /abc -> a is lowercase, the rewrite would take place. /aBcD would be substituted with redirect.cfm, too.
> If you're looking for a complete lowercase match, use as RegEx

You're quite right.  The client is using camelCasing as part of their development standards, so this allows for any links that have been created using camel case.

Thanks for the rewritecond above - that worked perfectly. Bizarrely, I have already tried something similar, but was getting an error.  Not really sure what I did differently.
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.