Forwarding request to another apache server

Discussion in 'Apache' started by tuty_richard, Nov 29, 2008.

  1. #1
    I have my static IP set to my router. I am running two web servers. I have forwarding all my request on 80 port from the router to my server 1 its working fine. I need a help in setting up like this

    I have domain say mydomain.com when ever I type mydomain.com in my browser it comes to my router then to my server 1 thats fine.

    I have sub domain say mail.mydomain.com when ever I type mail.mydomain.com the router redirects to my webserver1. but what I need is my mail.mydomain has to be served by my server 2. How can I achieve this by using the apache running on my server 1.

    Thanks
    Richard
     
    tuty_richard, Nov 29, 2008 IP
  2. evera

    evera Peon

    Messages:
    283
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this, it forwards any request of mail.mydomain.com to the ip xxx.xxx.xxx.xxx
    If you put that on server 1 it will forward it to the ip of server 2
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^mail\.mydomain\.com [NC]
    RewriteRule ^(.*) http://xxx.xxx.xxx.xxx/mail/[P,L]
    Code (markup):
     
    evera, Nov 29, 2008 IP