header() 301 and 302

Date 2006-10-29 06:54:04 | Category: PHP

in englishin japanese
On site moving like PEAK XOOPS, we should return 301 instead of 302.
You should know php's header("Location:...") returns 302 if you don't send 301 additionally.
I've just fixed this


DocumentRoot
-- xoops_redirect.php
-- xoops/
---- .htaccess
---- index.html (dummy)


/xoops_redirect.php

<?php
$uri = strtr( substr( $_SERVER['REQUEST_URI'] , 6 ) , array( "\n" => '' , "\r" => '' ) ) ;

header( "HTTP/1.0 301 Moved Permanently" ) ;
header( "Location: http://xoops.peak.ne.jp".$uri ) ;
?>


/xoops/.htaccess

ForceType xoops_redirect
Action xoops_redirect /xoops_redirect.php





You can read more news at PEAK XOOPS.
http://xoops.peak.ne.jp

The URL for this story is:
http://xoops.peak.ne.jp/md/news/index.php?page=article&storyid=390