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 have searched high a low for a solution for this, and hoping it is just me. What I'm trying to do is redirect all traffic from a URL we host, to another server managed by another provider we purchase from so we can customize the root URL.

I'm using httpd 2.2.3 (Apache). This is configured in a VirtualHost section, it is also SSL (I don't think that should matter however).

Everything works great, except the exclusion.

What I have (simplified) is:

ProxyPreserveHost On

<VirtualHost>        SSLProxyEngine On
    ProxyPassMatch ^/$   !
    ProxyPassMatch ^/(.*)$$1
    ProxyPassReverse /

    SSLEngine on


However it always goes to the remote site. I have tried a bunch of combinations such as:

    ProxyPassMatch /$   !
    ProxyPassMatch ^/(.*)$$1
    ProxyPassMatch com/   !
    ProxyPassMatch ^/(.*)$$1

I also tried going the other way (to match anything with something after the /, ie:

    ProxyPassMatch ^/(..+)$$1
    ProxyPassMatch /    !
    ProxyPassMatch ^/(..*)$$1
    ProxyPassMatch /    !

Now the documentation says it matches the URL, but I have found no evidence that this is what it actually does (ie: second variant above with com/).

I have also tried a bunch of other combinations which either match everything, or match nothing.

My thinking is I'm not understanding the URL that is getting given to the regular expression, but not sure how to look at it. I have turned up the debug level in Apache to debug, and it does not give anything useful either.


share|improve this question
Please write up your solution as an answer and mark it as accepted. – slm Mar 28 '13 at 4:21

If I had to guess, I would say your problem comes from the "^/.*$" match, which will match '/'. If you dropped the explicit match to / and replaced the proxy pass with "^/.+$" is may resolve your issue. No promises though.

The difference is the * is equivalent to .{0,} while + is equivalent to .{1,}, so .* will match any or no characters, whereas you want a match on at least one.

share|improve this answer
up vote 0 down vote accepted

I figured out an answer, or more of a work around: to use another server (in this case a local server still on the same httpd instance).

ie: The lines above now read:

ProxyPassMatch ^/$
ProxyPassMatch ^/(.*)$$1 

(plus the usual host config to run on a new port, and config of a virtual host on that port). It is a bit messy, but appears to sort it out!

I'm still keen to know if I have done something wrong and there is a "correct" answer to this - as I consider this a bit of a hack.

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.