Link to home
Start Free TrialLog in
Avatar of Mr_Nil
Mr_NilFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mr_Nil

ASKER

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