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.

redirect on same server

Discussion in 'Apache' started by travisb, Nov 9, 2004.

  1. #1
    I have oldsite.com and just added newsite.com. I want to phase out the use of oldsite.com. I would like for everyone (and search engines) to redirect from oldsite.com/anypage.html to the same page on newsite.com.

    I tried using an .htaccess file like this:
    Redirect permanent / http://www.newsite.com/
    but got errors about exceeding the limit of redirects.
    SEMrush
    Both sites are on the same server so they both get the .htaccess file, which I guess is causing the problem. How can I get around this?
     
    travisb, Nov 9, 2004 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    digitalpoint, Nov 9, 2004 IP
  3. travisb

    travisb Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ok, so do I put this in a .htaccess file? I tried this but it did not do anything when going to the top level of the site. The urls stayed the same. Going deeper in the site produced 404s on both the new and old site.

    <VirtualHost 65.18.***.***>
    ServerName www.newsite.com
    ServerAlias www.oldsite.com oldsite.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^65.18.***.***:)80)?$
    RewriteCond %{HTTP_HOST} !^www.newsite.com:)80)?$
    RewriteRule ^/(.*) http://www.newsite.com/$1 [L,R=301]
    </VirtualHost>
     
    travisb, Nov 9, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,297
    Likes Received:
    2,602
    Best Answers:
    461
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    No, that example would be for your httpd.conf file. Although it could be modified a bit for use in an .htaccess file.

    Also, for the record, your problem isn't that you are redirecting to the same server, it's a problem because you are redirecting to the same SITE, and specifically redirecting to the same page. So it runs itself into a redirection loop.
     
    digitalpoint, Nov 9, 2004 IP
  5. Andre

    Andre Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    mod_redirect might be a good solution.
     
    Andre, Nov 23, 2004 IP