0

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?

Rich
  • 1,333
  • 5
  • 27
  • 39

2 Answers2

1

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).*$
Janne Pikkarainen
  • 31,454
  • 4
  • 56
  • 78
0

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]
Smudge
  • 24,039
  • 15
  • 57
  • 76