aboutsummaryrefslogtreecommitdiff
path: root/engine/handlers
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-10 22:03:20 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-10 22:03:20 +0000
commit4361dc15a79480675b055d6c3baad593adb8343b (patch)
treea17ee49753b1096f45fde9663341ed8f920b47c5 /engine/handlers
parent9925507bbe4465772e246daa24009e463422211b (diff)
downloadelgg-4361dc15a79480675b055d6c3baad593adb8343b.tar.gz
elgg-4361dc15a79480675b055d6c3baad593adb8343b.tar.bz2
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
Diffstat (limited to 'engine/handlers')
-rw-r--r--engine/handlers/page_handler.php21
1 files changed, 20 insertions, 1 deletions
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');