# forwarding a domain.com/alias to another server on the network



## clive306 (Feb 15, 2010)

Hi All,

was hoping for a little help, sorry if this has already been answered in another topic.

basically a have built a freebsd box running apache to host a website. so currently i have port 80 setup to forward that box (lets say 192.168.1.20)

I have a web application on a windows box (sorry if this is classed as swearing on here) which also requires port 80 (lets say 192.168.1.30).

with having the freebsd box setup to handle all requests for port 80, is there any setup i can do within httpd.conf to allow me to forward the detault domain.com/secondsite to the ip of the windows box (192.168.1.30)?

if this isn't possible, what is the best way for me to acheive this.

many thanks in advance.

Clive.


----------



## Ruler2112 (Feb 15, 2010)

I know you can set up a virtual host in apache with /usr/local/etc/apache/extra/vhosts.conf to point requests to app.yoursite.com to a different directory on your BSD box, but do not know if you can point this to another box on your local network.  I do something like this to handle requests to the various domains on my box that don't have a site tied to them - I just forward the user with index.html to another.  Doing this (I think) would require the site you forward to be accessible from the internet.

If you forward a different port through your firewall to port 80 on your windoze box, this might work.  Just set up a virtual host and have index.html forward the user to yoursite.com:12345.  The firewall would handle translating port 12345 to port 80 on the windoze box, so requests would come into port 80 on windoze and yet appear to the user to be on port 12345.  (Or whatever port you decide to forward.)  Doing it this way would show the user a page saying 'you're being forwarded' or something like that briefly.  One of my index.html files looks like this:


```
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://example.com">
<html>
  <head>
    <title>Directing to Main Page</title>
  </head>
  <body>
Automatically redirecting you to our main page.
    


If you are not redirected in 10 seconds, please <a href="http://example.com">click here.</a>
  </body>
</html>
```


----------



## Alt (Feb 15, 2010)

Look mod_proxy


----------



## sixtydoses (Feb 16, 2010)

URL rewriting could be handy too.


----------

