title: Apache redirect to a port and mask the URL
body: <p>I have one web server running two sites on different ports.
  IE: server:8081 and  server:8083
  I setup two DNS records and pointed it to “my server”</p>
  
  <p>Dev.server.com and Pre.server.com</p>
  
  <p>I would like Dev.server.com to redirect to server:8083 but mask the URL to always stay Dev.server.com and Pre.server.com to redirect to server:8081 but mask the URL to always stay pre.server.com</p>
  
  <p>If I set them up like this</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  ServerName http:// Dev.server.com
  ProxyRequests off
  ProxyPass / http://server:8083
  ProxyPassReverse / http://server:8083
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:80&gt;
  ServerName http:// Pre.server.com
  ProxyRequests off
  ProxyPass / http://server:8081
  ProxyPassReverse / http://server:8081
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Everything routes to the Dev instance and nothing makes it to the Pre instance</p>
  
  <p>I have it set like this;</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  ServerName http:// Dev.server.com
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^dev\.server\.com$ [NC]
  RewriteRule ^(.*)$ http:// Dev.server.com:8083$1 [R]
  RewriteCond %{HTTP_HOST} ^pre\.server\.com$ [NC]
  RewriteRule ^(.*)$ http://pre. server.com:8081$1 [R]
  &lt;/VirtualHost&gt;
  Listen 0.0.0.0:8083
  Listen 0.0.0.0:8081
  &lt;VirtualHost *:8083&gt;
  ServerName dev. server.com
  ProxyRequests off
  ProxyPass / http:// server.com:8083/jde/owhtml/
  ProxyPassReverse / http:// server.com:8083/jde/owhtml/
  Oc4jMount /jde HTML_DV_8083
  Oc4jMount /jde/* HTML_DV_8083
  &lt;/VirtualHost&gt;
  
  &lt;VirtualHost *:8081&gt;
  ServerName pre.server.com
  ProxyRequests off
  ProxyPass / http:// server.com:8081/jde/owhtml/
  ProxyPassReverse / http:// server.com:8081/jde/owhtml/
  Oc4jMount /jde HTML_PY_8081
  Oc4jMount /jde/* HTML_PY_8081
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>This works perfectly for the routing but does not mask the URL. It adds the port to the URL witch we do not want to happen.</p>
  
  <p>Anyone have any ideas as to what I am doing wrong?</p>