aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/handlers/page_handler.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/engine/handlers/page_handler.php b/engine/handlers/page_handler.php
index 491a1b200..1ed295b7d 100644
--- a/engine/handlers/page_handler.php
+++ b/engine/handlers/page_handler.php
@@ -28,16 +28,18 @@
* @link http://docs.elgg.org/Tutorials/PageHandlers
*/
-require_once(dirname(dirname(__FILE__)) . "/start.php");
-$url = current_page_url();
-$new_url = preg_replace('#/pg/#', '/', $url);
+// Permanent redirect to pg-less urls
+$url = $_SERVER['REQUEST_URI'];
+$new_url = preg_replace('#/pg/#', '/', $url, 1);
if ($url !== $new_url) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: $new_url");
}
+require_once(dirname(dirname(__FILE__)) . "/start.php");
+
$handler = get_input('handler');
$page = get_input('page');