From bacd080989d19ddb34cde8b9a4c22169c4562267 Mon Sep 17 00:00:00 2001 From: rboren Date: Tue, 1 Feb 2005 07:05:00 +0000 Subject: [PATCH] Use parse_url instead of regex wackiness. git-svn-id: http://svn.automattic.com/wordpress/trunk@2187 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/classes.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 6c977ac171..7eaf2159ce 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -1154,14 +1154,12 @@ class WP_Rewrite { return ''; } - $site_root = str_replace('http://', '', trim(get_settings('siteurl'))); - $site_root = preg_replace('|([^/]*)(.*)|i', '$2', $site_root); - if ('/' != substr($site_root, -1)) $site_root = $site_root . '/'; - - $home_root = str_replace('http://', '', trim(get_settings('home'))); - $home_root = preg_replace('|([^/]*)(.*)|i', '$2', $home_root); - if ('/' != substr($home_root, -1)) $home_root = $home_root . '/'; + $site_root = parse_url(get_settings('siteurl')); + $site_root = trailingslashit($site_root['path']); + $home_root = parse_url(get_settings('home')); + $home_root = trailingslashit($home_root['path']); + $rules = "\n"; $rules .= "RewriteEngine On\n"; $rules .= "RewriteBase $home_root\n";