Home » osCommerce » SEO : old Url to new URL htacess and PHP way

SEO : old Url to new URL htacess and PHP way

old Url to new URL htacess and PHP way:
ErrorDocument 404 /errors/404error.php
Use the below code of php for the 404error.php file
If you had an old URL say product10.html and now U have it as mobile-name.html.
The scenario is that either Search engine value of that page is lost.
To over come this we searched across and found this solution.
// BOF 49.248.5.148/development/oscprofessionals-new-theme
// Redirect visitors with a custom 404 error page.
$request=$_SERVER

[‘REQUEST_URI’];
$urlarray=array(“/product10.html”=>”/mobile-name.html”);
if(array_key_exists($request,$urlarray))
{
$newplace=”https://”.$_SERVER[‘HTTP_HOST’].$urlarray[$request];
header(“HTTP/1.0 301 Moved Permanently”);
header(“Location: $newplace”);
header(“Connection: close”);
exit();
}
else
{
header(“HTTP/1.0 404 Not Found”);
}
// EOF 49.248.5.148/development/oscprofessionals-new-theme
?>
#
——————————————————————————————————————————————
This entry was posted on Wednesday, August 25th, 2010 at 6:08 PM and is filed under Uncategorized.You can follow any responses to this entry through the RSS 2.0 feed.
Responses are currently closed, but you can trackback from your own site.

——————————————————————————————————————————————