From ee8559b6571c78c47ef0cb5fcd4fe615685d0d04 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 3 Sep 2014 12:23:28 +0000 Subject: [PATCH] Add support to redirect permanently git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1790 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- route.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/route.php b/route.php index 5f08e4e..82a82ee 100644 --- a/route.php +++ b/route.php @@ -104,8 +104,9 @@ class route If module is set, the site is modular and a directory is named with module name @param string $destURL Do a redirection of the HTTP page - @param string $module The module name */ - function redirect ($destURL, $module) + @param string $module The module name + @param boolean|null Permanent redirect (false by default) */ + function redirect ($destURL, $module, $permanent = false) { if (php_sapi_name () === "cli") exit; @@ -151,6 +152,8 @@ class route { header ("Cache-Control: no-store, no-cache, must-revalidate"); header ("Pragma: no-cache"); + if ($permanent) + header ("HTTP/1.1 301 Moved Permanently"); header ("Location: $destURL"); } else