From 4361dc15a79480675b055d6c3baad593adb8343b Mon Sep 17 00:00:00 2001 From: ewinslow Date: Thu, 10 Mar 2011 22:03:20 +0000 Subject: Refs #2228: Deprecated use of pg/ in page handlers. Now we get to have nice clean urls like "example.com/bookmarks" git-svn-id: http://code.elgg.org/elgg/trunk@8651 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/handlers/page_handler.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/handlers/page_handler.php b/engine/handlers/page_handler.php index c71e820b2..bfdb0cee3 100644 --- a/engine/handlers/page_handler.php +++ b/engine/handlers/page_handler.php @@ -3,9 +3,21 @@ * Pages handler. * * This file dispatches pages. It is called via a URL rewrite in .htaccess - * from http://site/pg/handler/page1/page2. The first element after 'pg/' is + * from http://site/handler/page1/page2. The first element after site/ is * the page handler name as registered by {@link elgg_register_page_handler()}. * The rest of the string is sent to {@link page_handler()}. + * + * Note that the following handler names are reserved by elgg and should not be + * registered by any plugins: + * * action + * * cache + * * services + * * export + * * mt + * * xml-rpc.php + * * rewrite.php + * * tag (deprecated, reserved for backwards compatibility) + * * pg (deprecated, reserved for backwards compatibility) * * {@link page_handler()} explodes the pages string by / and sends it to * the page handler function as registered by {@link elgg_register_page_handler()}. @@ -18,6 +30,13 @@ require_once(dirname(dirname(__FILE__)) . "/start.php"); +$url = current_page_url(); +$new_url = preg_replace('#/pg/#', '/', $url); +if ($url !== $new_url) { + header("HTTP/1.1 301 Moved Permanently"); + header("Location: $new_url"); +} + $handler = get_input('handler'); $page = get_input('page'); -- cgit v1.2.3