1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Subdomain redirection to another subdomain

Discussion in 'Site & Server Administration' started by geekology, Apr 5, 2012.

  1. #1
    I would like to redirect a subdomain -

    subdomain1.example.com to subdomain2.example.com

    What is the best way to do that? using htaccess? DNS?

    Any ideas are most welcome!
     
    geekology, Apr 5, 2012 IP
  2. tiffanywilliams12i2

    tiffanywilliams12i2 Peon

    Messages:
    164
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    either works dns puts no strain on the webserver
     
    tiffanywilliams12i2, Apr 5, 2012 IP
  3. henrywilliams

    henrywilliams Peon

    Messages:
    119
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What kind of Server you are using to host your website?
    Apache or Microsoft?
    .htacess is best for Apache server and DNS works with Microsoft server.
     
    henrywilliams, Apr 6, 2012 IP
  4. Iann@LFCVPS

    Iann@LFCVPS Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If using IIS you could also use ISAPI Rewrite or Helicon APE to do your rewriting rules. If neither of those work and you are using IIS you could point the DNS for the second domain at the same IP as the first and setup additional host header values in the sites configuration.
     
    Iann@LFCVPS, Apr 27, 2012 IP
  5. Joker-jar

    Joker-jar Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Add "A" records (subdomain1.example.com, subdomain2.example.com) to DNS with same IP-address. Configure Apache's virtual host something like:

    <VirtualHost *:80>
    ServerName subdomain1.example.com
    ServerAlias subdomain2.example.com
    ...
    Code (markup):
    And make .htaccess in the vhost's doc root:

    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} ^subdomain1.example.com$
    RewriteRule (.*) http://subdomain2.example.com/$1 [R=301,L]
    Code (markup):
     
    Joker-jar, May 5, 2012 IP