Webmasters Stack Exchange is a question and answer site for pro webmasters. 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

I am using Apache 2 and using the below virtual host definition in httpd.conf file

<VirtualHost *>
    ServerName localhost   
    ProxyPass / http://localhost:8080/stackoverflow/ 
    ProxyPassReverse / http://localhost:8080/stackoverflow/ 
    RewriteEngine On
    RewriteRule  ^(market|stock|mutual)$ stackoverflow/$1 [L]

Here, when I type


then Apache internally rewrite the URL and show me the contents of


Now my problem is: When I click on any of the link of that site having following URL


Then, My address bar will show the above URL

I want my Apache server to redirect me to


means User will be shown the above URL, but the contents will come from


I was thinking if I need to set reverse proxy for this. Please help me on this.

share|improve this question

This is what a proper reverse proxy should look like:

<VirtualHost *:80>
        ServerName sub.domain.org
        ProxyRequests Off
        ProxyPreserveHost On
        ProxyVia full
        ProxyPass /
        ProxyPassReverse /
        ErrorLog /var/log/apache2/error_name.log
        LogLevel warn
        CustomLog /var/log/apache2/access_name.log combined

But it is REALLY unclear what you are doing. Do you WANT it to rewrite to port 8080? Are you just trying to rewrite the URL (remove one subdirectory)? If so, then you can stick with standard rewrite rules rather than a reverse proxy.

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.