Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 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/
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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