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

I have two virtual hosts in a apache server and I would like to do something but I don't know if is possible.

The thing is that I have the main application developed and ruby and the blog is in wordpress. So right now I have something like this:

  • and

What I would like to do is that all the request to are served by the, but without doing a redirects (i.e I don't want the user to see a change in the URL)

What I've tried so far is to do a proxy in the VirtualHost:

<Location  /blog>
    RewriteEngine On
    RewriteRule blog/(.*)$$1 [QSA,P,L]

And it works, but once I'm in the other app all the links are inside and not in

Do you know a workaround for this?

Thanks in advanced for your help.

share|improve this question

2 Answers 2

Links are handled in your content, not by Apache. ProxyPassReverse only translates for redirects - everything else is on you.

Fix it by using host-relative paths in your content - instead of linking to, link to /dir/page.html.

If the links are being dynamically generated by WordPress, then it's probably reading the host header; ProxyPreserveHost would be the normal way around this, but won't work with both vhosts being on the same listener - you'd end up feeding requests right back to the vhost that's doing the proxying.

share|improve this answer

For a reverse proxy, fixing the links in your content output (as mentioned in the other answer) is the better way to go, however mod_proxy_html is another possibility.

That said, if you're serving both applications out of the same Apache server why bother with the two virtual hosts? You should be able to serve two different languages from the same virtual host, that way you can skip the reverse proxy step completely.

share|improve this answer
Oh ok! thanks, Could you tell me where to read to learn how to serve two applications with differents languages in the same virtual host? – Rafael Aug 26 '11 at 6:24
Pretty much the same way you do it for one. Just use <Location> and <Directory> as necessary to isolate the settings for each and use your rewrite rules to route the request to the correct app entry points. – matthew Aug 26 '11 at 14:16

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.