Forum Moderators: coopster
Of course JavaScript refreshes and meta refreshes where out of the question because they are not SEO friendly. The simple header 301 status & header redirect option was out because it redirects before any message can be shown. So I was in luck when I discovered the handy php header refresh function. After this discovery, it took only a minute to code this:
//set header
header("HTTP/1.1 301 Moved Permanently");
//perform url refresh in 3 seconds
header( 'refresh: 3; url=http://www.example.com' );
//print temp message here
echo '<html>.........';
It seemed to be a simple solution, and worked perfectly in firefox; catching all 404 errors, giving the right 301 header, displaying the custom message and redirecting.
To my dismay, I found that this solution doesnt work for IE. In fact, its seems IE doesnt work if you attempt to display output after this header status code.
I could probably code a clunky workaround for this task, but I'd rather have the elegant solution that I got with this code in Firefox. Is this a known bug? Did I overlook something? Is there any even simpler solution?
Please help
Thanks!
In this situation, my first thought would be to use some form of cloaking (even if it is just simple user agent detection for Googlebot, Slurp and MSNBot) to issue a standard 301 redirect to the bots and a meta refresh with expanation to everyone else. Either that, or convince your client that the silent 301 is the better solution for all.
//404 file
header('HTTP/1.1 301');
header("Location: http://example.com/refresh.php);
then
//refresh.php
header( "refresh: 3; url=http://example2.com" );
echo '<html> ....';
this works fine, but is this Search Engine friendly? would I get the pageRank to propagate through to e.g. example2.com.
Thanks