Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following configuration in an Apache configuration file for a CGI script:

RewriteEngine on
RewriteCond %{QUERY_STRING} !^/var/log/syslog-ng/JBoss.*$
RewriteRule ^/cgi-bin/(.*)$ /secure-cgi-bin/$1 [R=301,L,QSA]

The idea being that if someone uses the CGI script to view a path other than ones beginning /var/log/syslog-ng/JBoss, they should be redirected through a secured CGI script instead.

I would now like to change the RewriteCond so that a second path can also be viewed without going through the secure CGI. This second path is /var/log/syslog-ng/Tomcat.

How do I go about making this change?

share|improve this question
up vote 1 down vote accepted

You can use multiple lines and [OR] flag like samarudge told you, but since you only have slightly different paths, here's a reminder: ReWriteCond/Rule supports regular expressions, so format like this is possible, too:

RewriteCond %{QUERY_STRING} !^/var/log/syslog-ng/(JBoss|Tomcat).*$
share|improve this answer

You should just be able to chain multiple RewriteCond with the [OR] flag

RewriteEngine on
RewriteCond %{QUERY_STRING} !^/var/log/syslog-ng/JBoss.*$ [OR]
RewriteCond %{QUERY_STRING} !^/var/log/syslog-ng/Tomcat.*$ [OR]
RewriteRule ^/cgi-bin/(.*)$ /secure-cgi-bin/$1 [R=301,L,QSA]
share|improve this answer

Your Answer


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.