Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 am trying to write a redirect rule that will send all incoming requests directed at given server alias. Below is what my .conf file looks like. I am having problems with the first rule associated with The rewrite for requests with the alias simply does not happen. I am not even sure how to debug this...

    NameVirtualHost xxx.xx.x.194
    <VirtualHost xxx.xx.x.194>

      RewriteEngine on
      RewriteRule ^(.*)$ /cgi-bin/ [L,QSA,PT]
      SetEnv force-proxy-request-1.0 1
      SetEnv proxy-nokeepalive 1
    <VirtualHost xxx.xx.x.194>

     Include /etc/httpd/conf.d/zumodo.common

     ErrorLog logs/zumodo_errors_log
     CustomLog logs/zumodo_log combined
      SetEnv force-proxy-request-1.0 1
      SetEnv proxy-nokeepalive 1
share|improve this question
Are you saying you want the rewrite to happen on requests to, but not to Or to both? If it's both, then that looks fine; try setting a RewriteLog and turn up RewriteLogLevel 9. – Shane Madden Dec 6 '11 at 22:23
I want to rewrite to both. Where do I set RewriteLog and RewriteLogLevel and where will the logs be? – Spencer Dec 6 '11 at 22:24
note I am using etc/http/conf/http.conf – Spencer Dec 6 '11 at 22:25
Also when I add this command, nothing get logged to this log... – Spencer Dec 6 '11 at 22:30

Try with

RewriteRule /?(.*) /cgi-bin/ [L,QSA,PT]

For debugging, try adding:

RewriteLog "/var/log/apache2/rewrite.log"
RewriteLogLevel 3
share|improve this answer

This rule:

RewriteRule ^(.*)$ /cgi-bin/ [L,QSA,PT]

means: "redirect all the requests to /cgi-bin/"

Is that what you actually want to do?

If no, please give two examples of Incoming URLs and how they should be transformed.

Anyway here are my 2 usual hints:

Two hints:

Please try to use the RewriteLog directive: it helps you to track down such problems:

# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On

My favorite tool to check for regexp: (don't forget to choose ereg(POSIX) instead of preg(PCRE)!)

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.