301 Multiple Redirect

Discussion in 'Site & Server Administration' started by donnareed, Apr 6, 2007.

  1. #1
    I have an existing site A I want to redirect to existing site B, in order to consolidate my content, since they are both on the same theme.

    I know how to do a straight 301 redirect. What is making me a little gunshy is the fact that exisitng site A has a 301 redirect in place at the moment which I added in order to transition from .html pages to .php pages, like so:
    What would be the best way to handle this in order to keep the html to php, but also to redirect to Site B?

    1) .html site A -> .php site A -> .php site B
    2) .html site A -> .php site B
    3) .html site A -> .html Site B +
    .html site A-> .php Site B
    4) something else?

    Any ideas?
     
    donnareed, Apr 6, 2007 IP
  2. Pat Gael

    Pat Gael Banned

    Messages:
    1,331
    Likes Received:
    68
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The best way is add a file handler so your .htaccess file, that way does not really care if site A or site B is either php or html because both extensions will be parsed as PHP

    
    
    AddHandler application/x-httpd-php .html .htm .php
    
    
    Code (markup):
     
    Pat Gael, Apr 6, 2007 IP
  3. donnareed

    donnareed Peon

    Messages:
    340
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Pat.

    Should that be added to the old site's .htaccess or the new site, Site B?
     
    donnareed, Apr 6, 2007 IP
  4. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Don't use that. It tells your server to treat those extensions as PHP files. Now every time a .HTML file is requested, instead of simply being sent straight back to the user, it must first be parsed through the PHP engine - even if its just a plain html file. The performance hit this has will depend on both your server and the amount of traffic. You could probably get away with it but it's not a very good practice. You were along the right lines with mod_rewrite.

    The best solution would not involve sending more than one redirect header, so in the htaccess for Site A:
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^(.*)\.html $1.php
    RewriteRule ^(.*)$ http://www.siteB.com/$1.php [R=301,L]
    Code (markup):
    If its a .html, we first rewrite to .php internally (without redirecting). Then we redirect everything to the new domain.

    In theory, there should not be any links to a .html site B page if its a new domain. The inlinks to .html site A pages have already been sorted to redirect straight to site B .php, so you shouldn't need any redirects on site B.
     
    rodney88, Apr 6, 2007 IP
  5. donnareed

    donnareed Peon

    Messages:
    340
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks, rodney88, that makes sense. But shouldn't it be redirected to site B, like this:

    you wrote:

     
    donnareed, Apr 6, 2007 IP
  6. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Whoops, sorry my bad. Yes, it should be site B. Apologies for any confusion.
     
    rodney88, Apr 6, 2007 IP