From c7f54da90b37b410bd9589b42b01d38067778f11 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Thu, 16 Oct 2008 19:17:04 +0000 Subject: [PATCH] Strip trailing /index.php in Canonical, fixes #5017. fixes #7173. git-svn-id: http://svn.automattic.com/wordpress/trunk@9203 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/canonical.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 54444e000d..a2c0a19635 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -54,7 +54,10 @@ function redirect_canonical($requested_url=null, $do_redirect=true) { return; // Some PHP setups turn requests for / into /index.php in REQUEST_URI - $original['path'] = preg_replace('|/index\.php$|', '/', $original['path']); + // See: http://trac.wordpress.org/ticket/5017 + // See: http://trac.wordpress.org/ticket/7173 + // Disabled, for now: + // $original['path'] = preg_replace('|/index\.php$|', '/', $original['path']); $redirect = $original; $redirect_url = false; @@ -177,8 +180,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) { else unset($redirect['port']); - // trailing /index.php/ - $redirect['path'] = preg_replace('|/index.php/$|', '/', $redirect['path']); + // trailing /index.php + $redirect['path'] = preg_replace('|/index.php/*?$|', '/', $redirect['path']); // Remove trailing spaces from the path $redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] );