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.

New domain -> sub-domain to sub-domain redirection

Discussion in 'Apache' started by psylence, Jan 16, 2008.

  1. #1
    I don't seem to be getting anywhere with this. I've searched google, but all I can find is an endless pool of sub-domain to domain redirects, nothing with sub-domain to sub-domain.

    Scenario: I run a website that was, as of yesterday, using a .com domain. I am now switching it to a .net domain. I host some sub-sites on it that are accessible via sub-domains and I am trying to figure out how I can automatically redirect them to the new domain.

    For example someone would enter

    http://sub.domain.com and it should go to http://sub.domain.net

    Also, it's possible there will be folders and filenames at the end, for example:

    http://sub.domain.com/dir/file.txt should go to http://sub.domain.net/dir/file.txt

    For the domain by itself I already have the following, which works, but I'm at a loss for trying to redirect the sub-domains as well:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://new-domain.net/$1 [R=301,L]
    Code (markup):
    Any insight is appreciated.
     
    psylence, Jan 16, 2008 IP
  2. incoe

    incoe Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if you forwarded the whole domain wont it work? cause user to host a website on a domain then moved it to a subdomain then forwarded the domain to that subdomain so when the user comes through google to a certain domain link it forwards him to the subdomain with the same link after the domain like from example.com/blog/post to sub.example.com/blog/post, not sure if it helps but its worth a try.
     
    incoe, Oct 15, 2011 IP