Best Option For Redirect

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    Best Option For Redirect

    Hi ,
    i was in an argue with one of my colleagues on redirection i have been using the .htaccess for redirecting urls to new domain urls , now the question is that if i have changed my domain to a new domain lets say from abc.com to xyz.com and i have the same name of the pages and everything , i want that my old urls lets say

    abc.com/profile/omer


    should be redirected to

    xyz.com/profile/omer


    what my colleague recommends is to use
    [code=php]
    strstr()
    [/code]

    and find the domain name (abc.com)in the url and replace it with the new domain (xyz.com) and include it in the config file which is already included in all pages , and not to use the .htacess redirect as we have to type in all the urls into the .htaccess file , seems to be short though and quick , but i always go for the safest option , what do anyone of you recommend doing , one more thing the way strstr() is used that means that all the pages need to exist on the old site (abc.com) as well as new site (xyz.com) would that cause any difference to the indexing on google? or would the similar text on both the domains create the problem for the bots? , any SEO regarding problem using the strstr() method?
    Reagrds,
    Omer Aslam
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    If you will be redirecting all pages from your old domain to your new one, a simple redirect from the server (via .htaccess or whatever) would suffice. Something like:
    Code:
    RewriteRule ^(.*)$ http://newdomain/$1 [R=301]

    Comment

    • nathj
      Recognized Expert Contributor
      • May 2007
      • 937

      #3
      The advatnage of using .htaccess is that you can specify it as a 301 redirect. This method maintains any link equity that you may have built up with search engines like Google and Yahoo.

      Which is what Markus is doing with the '[R=301]' part of the line.

      If you do it with php functions you will damage the link equity you have built up.

      Cheers
      nathj

      Comment

      Working...