Moving Domains
I’ve moved my site, obviously. I didn’t have time to plan it, but scrambled last night to move all my content, fix all the broken stuff, and work on a redirect for the old site. I’m glad I used a lot of server side includes and tried to keep site-specific paths and url’s to a minimum. I put considerable thought and work into managing traffic redirection and search engine optimization. I’ll sketch it out.
I used a .htaccess rule to redirect all traffic to a single php page. Perhaps the most important function of this page is to return a ‘301: Moved Permanently’ HTTP status code to alert search engines that the intended page has moved. I did it with this line <?php header(”HTTP/1.0 301 Moved Permanently”); ?> Also, I captured the requested URI and used it to build a new URI to the page in it’s new location. I used the new URI to build a meta refresh tag in the header and a link for the visitor to click if they don’t feel like waiting the 4 seconds to be redirected.
In the header I have this:
<?php
$newuri = ltrim($_SERVER['REQUEST_URI'], “/~jtuttle/”);
echo “<meta http-equiv=\”refresh\” content=\”4;url=http://www.braggtown.com/$newuri\”>”;
?>
and in the body I have this:
<?php
$uri = $_SERVER['REQUEST_URI'];
$ref = $_SERVER['HTTP_REFERER'];
$newuri = ltrim($uri, “/~jtuttle/”);
echo “The page you were looking for should be at <a href=\”http://www.braggtown.com/$newuri\”>www.braggtown.com/$newuri</a>.”;
?>
I’m also keeping tracking of referrers to the page to request URI changes where I think it’s possible. I’ve submitted a new site map to Google, too. Nothing to do now but wait to see what happens. It’s not like this is a for-profit site so it’s really just an academic exercise. Using curl I can see the status code is working:
me@unix:~$ curl –head “http://www.prairienet.org/~jtuttle/stuff.php”
HTTP/1.1 301 Moved Permanently
Date: Fri, 22 Jun 2007 21:02:33 GMT
Server: Apache/1.3.34 (Unix) PHP/5.1.6
X-Powered-By: PHP/5.1.6
Content-Type: text/html

Comments (RSS)
