Add support to redirect permanently
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1790 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -104,8 +104,9 @@ class route
|
|||||||
If module is set, the site is modular and a directory is named with module
|
If module is set, the site is modular and a directory is named with module
|
||||||
name
|
name
|
||||||
@param string $destURL Do a redirection of the HTTP page
|
@param string $destURL Do a redirection of the HTTP page
|
||||||
@param string $module The module name */
|
@param string $module The module name
|
||||||
function redirect ($destURL, $module)
|
@param boolean|null Permanent redirect (false by default) */
|
||||||
|
function redirect ($destURL, $module, $permanent = false)
|
||||||
{
|
{
|
||||||
if (php_sapi_name () === "cli")
|
if (php_sapi_name () === "cli")
|
||||||
exit;
|
exit;
|
||||||
@@ -151,6 +152,8 @@ class route
|
|||||||
{
|
{
|
||||||
header ("Cache-Control: no-store, no-cache, must-revalidate");
|
header ("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
header ("Pragma: no-cache");
|
header ("Pragma: no-cache");
|
||||||
|
if ($permanent)
|
||||||
|
header ("HTTP/1.1 301 Moved Permanently");
|
||||||
header ("Location: $destURL");
|
header ("Location: $destURL");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user