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

For example I want to set up a forward proxy to forward HTTP requests to,, to,,

Currently I have to configure 3 vhosts as:

  ProxyPass /
  ProxyPass /
  ProxyPass /

Is there any way to rewrite the domain part of http request? as:

ProxyPassMatch http://(.*).com/ http://$

I wonder if I must do it by RewriteRules, but I don't know how to write the rule exactly and the performance of RewriteRule v. ProxyPass, but performance isn't a big problem.

share|improve this question

migrated from Dec 19 '09 at 13:23

This question came from our site for computer enthusiasts and power users.

Depending on the details of your exact setup, this can be done using mod_rewrite. You would probably match on HTTP_HOST, strip out the part of the hostname that you want, and tack it onto, then use mod_rewrite's [P] flag to enable the proxy.

This isn't exactly what you want, but it might get you a little closer:

share|improve this answer

You want something like this:

RewriteCond %{HTTP_HOST} ^(.*)\.com
RewriteRule (.*) %{SERVER_PROTOCOL}://$1 [P]


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.