Forum Moderators: DixonJones

Message Too Old, No Replies

Supply Error 301 and new location without actual redirect

How can I send the location of the new address without an redirect?

         

Raistlin84

6:09 pm on Sep 5, 2009 (gmt 0)

10+ Year Member



Hi people,

my first posting in this forum - however, I've been reading for quite some while. Usually the answers in this forum are really good.

OK, to my question:
Recently, I registered a new domain name for my old website. Obviously, I would like to redirect the visitors of my old address to the new URL.

However, I really want people to realize that the old page has moved such that they update their bookmarks, own links and stuff, i.e. some "My page moved *bla bla*" page should be shown, with some big "Click here" link inside. This solution is of course the trivial part.

As far as I know the correct way to server-side automatically redirect the visitors of the old page would be so use the following PHP code:

<?php
header("Status: 301 Moved Permanently");
header("Location: [abcde.net");...]
?>

In particular, this code should (?) tell Google and other spiders the location of the new page, such that the "rank" of the old page would be taken into consideration for the new "page".

Unfortunately, the Location header immediately redirects the user to the new page, i.e. no page is shown and the visitor probably never truly realizes that the page moved.

Therefore, I would like to know, how to merge both approaches, i.e.:

a) Show a custom "We moved" page.
b) Tell Google and Other spiders that the page moved permanently and the new location.

Any help in this direction would be appreciated.

Thanks in advance,
Raistlin

jdMorgan

7:02 pm on Sep 5, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Raistlin, and welcome to WebmasterWorld!

You've pretty much answered your own question here

a) Show a custom "We moved" page.
b) Tell Google and Other spiders that the page moved permanently and the new location.

You'll just need to check the HTTP User-Agent header received with each request. If the UA is a search engine spider, then 301-redirect it using your code above (or any other server-side implementation). If the user-agent is a browser, then present the "we moved" page if the request is for a 'page', and redirect it if it is for anything else (i.e. I'm assuming you'd prefer to host all images, css, JavaScript, etc. files only on your new domain, just to simplify maintenance).

There are many other types of user-agents such as mobile transcoders, translation services, internet content filters, etc., and you may want to use these classifications too. If not, then the the problem simplifies down to "either it's a search engine spider, or it's not."

I don't recommend leaving this conditional-redirect system in place for more than a few months. There's no intent to deceive either search engines or visitors here, but this is user-agent-based content-delivery. And because some search engines use 'human reviewers' when their automated agents detect a difference between the content served to 'bots and humans, and because those humans can make mistakes, be lazy, or perhaps be trying to 'impress the boss,' I really don't trust them to make the right "This is cloaking/This is not cloaking" decision.

So I think it's best (and this is only my opinion) to leave such conditional redirects in place only long enough to accomplish the goal of informing *the majority* of your loyal/repeat visitors and those Webmasters who *will* update their links to your site that your domain has changed. After that, redirect everyone.

Jim

Raistlin84

11:00 pm on Sep 5, 2009 (gmt 0)

10+ Year Member



Hi Jim,

*D'OH*
I did not think on this rather obvious multiple choice way to do it... ;-)

OK, works perfectly.

Big thanks,
Raistlin