homepage Welcome to WebmasterWorld Guest from 23.22.217.122
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
redirecting a domain
whatson




msg:4551201
 4:09 am on Mar 5, 2013 (gmt 0)

We have a domain we wish to redirect to another one. What is is the best way to transfer to pagerank to the other domain?

 

phranque




msg:4551231
 5:24 am on Mar 5, 2013 (gmt 0)

301 status code on the response.

one-to-one correspondence between legacy urls and new urls for the redirects.
(no "wildcard" redirects to the home page.)
in other words redirect the old home page only to the new domain and 404/410 all other requests;
or, redirect requests for a specific set of legacy urls to the equivalent urls on the new domain and 404/410 all requests for "junk" urls.

whatson




msg:4551474
 6:45 pm on Mar 5, 2013 (gmt 0)

ok, so do I do that in the htaccess file?

phranque




msg:4551477
 7:03 pm on Mar 5, 2013 (gmt 0)

if you can translate the old urls to the new urls using a translation table or using patterns and well-defined rules with possible exceptions, you can use mod-rewrite directives in the .htaccess file.

if the url translation requires a database lookup then you will need to internally rewrite the old urls to a script that provides the proper response.
the internal rewrite will also require some mod_rewrite code in the .htaccess file.
it will be helpful if you can distinguish old urls from new urls for this internal rewrite.

anything more specific than that requires more information about what your urls look like.

whatson




msg:4551513
 9:28 pm on Mar 5, 2013 (gmt 0)

Actually what I want to do is catch any url from this domain, and redirect it to the homepage of the new url.
Is there some catch all redirect?

swa66




msg:4551522
 10:02 pm on Mar 5, 2013 (gmt 0)

Actually what I want to do is catch any url from this domain, and redirect it to the homepage of the new url. Is there some catch all redirect?


This raises the question:
Is then there no content on your new domain to satisfy the vistors on the old urls ?

I put it harsh, cause that's also what you'd be doing to visitors that end up on deep links and it's also the signal you send to search engines.

lucy24




msg:4551545
 11:09 pm on Mar 5, 2013 (gmt 0)

Is there some catch all redirect?

Yes, it's trivial. A single line in htaccess. In some shared-hosting setups you can even do it by clicking a button somewhere in your control panel.

What people are trying to find out is whether you are absolutely positive you want to do this, and are making an informed choice. Eventually we get to the "Awright, just show him how to aim the ### gun" part, but not yet.

phranque




msg:4551560
 12:31 am on Mar 6, 2013 (gmt 0)

that part where I said "no wildcard redirects to the home page".

you probably don't want to do that to your visitors.
the proper response is a 404 (or 410 if appropriate) status code.
then provide a custom error document that looks similar to your new domain's home page with sufficient navigation and/or search capability for the visitor to find the resource they were expecting when they clicked on the linked to or bookmarked url on the old domain.

if you try to redirect all the pagerank from the old domain the the new domain's home page you will likely lose most or all if it.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved