I have a site with this existing rule:

RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

so that it captures all URLs and translates them to this query.

How can I precede this with something that will make an exception for URLs of the form

http://www.example.com/services/{anything}

e.g. any URL that refers to something in a /services directory?

link|improve this question

72% accept rate
feedback

1 Answer

up vote 3 down vote accepted

Try:

RewriteCond %{REQUEST_URI} !/services

If you are putting this into .htaccess, you might need:

RewriteCond %{REQUEST_URI} !services

or

RewriteCond %{REQUEST_URI} !services/
link|improve this answer
is /services a regexp? do I need the ^ in front of it? – Jason S Dec 1 '09 at 2:30
Quite possibly it is. Try it with and without a ^ and see which works best. Also see the full docs on httpd.apache.org/docs/2.0/mod/mod_rewrite.html which is for apache 2.0 and probably hasn't changed recently. – Michael Graff Dec 1 '09 at 2:33
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.