About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / Documentation / Content Migration: Mapping Old Links Into Sitellite

Content Migration: Mapping Old Links Into Sitellite

Mapping the old site

You should now have a file named old_links.txt which contains a list of pages that existed on the old site that people have referred to. You will need to modify this file to identify the new pages in Sitellite that the old pages should correspond with. Any pages that don't correspond should be omitted, in which case we'll direct them either to the new web site index, or to a custom Sitellite 'page not found' page (your choice).

To do this, edit the old_files.txt file and add the Sitellite page ID of each page that should be mapped, followed by a tab character, to the beginning of each line of the file. When you're finished, your old_links.txt file should look something like this:

about_us	/about_us.html
contact_us	/contact_us.html
products	/products.html
services	/services.html

Making the error handler script

Now we're ready to create the 404 error handler script which will forward users based on the requested document. Save the following to a file called old_links.php in your web site document root:

<?php

$pages = file ('old_links.txt');

foreach ($pages as $key => $value) {
	list ($id, $old) = explode ("\t", $value);

	if ($_SERVER['REQUEST_URI'] == $old) {
		header ('HTTP/1.1 301 Moved Permanently');
		header ('Location: /index/' . $id);
		exit;
	}
}

header ('Location: /index');
exit;

?>

If you want to use a custom error handler instead of forwarding unknown 404 errors to the index page, you can simply specify that in the last header() call in the script.

Setting the ErrorDocument configuration

The last step is to tell Apache to use our new error handler. To do this, open up your .htaccess file and add the following line to the bottom of it:

ErrorDocument 404 /old_links.php

Now any broken links caused by your web site redevelopment should be forwarded automatically to the appropriate pages on your new web site.



Page 1: Taking stock
Page 2: Mapping the old site

All Tutorials

Members

Note: You can use your SitelliteForge.com account here and vice versa.

Username

Password

Forgot your password?

Not a member? Click here to register

Sitellite 5 Beta


Copyright © 2008, SIMIAN systems Inc.
All rights reserved. Privacy policy
Some of the icons on this site were created by the Gnome Project.