From 1c688ceead02a7de83ff2fd8bea2e422eaf6a3d7 Mon Sep 17 00:00:00 2001 From: dd32 Date: Sat, 10 Apr 2010 11:30:34 +0000 Subject: [PATCH] Check the appropriate radio option on the Permalinks page for the Root blog; Display index.php prefixes properly for the root Multisite Blog. Fixes #12952 git-svn-id: http://svn.automattic.com/wordpress/trunk@14051 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options-permalink.php | 57 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/wp-admin/options-permalink.php b/wp-admin/options-permalink.php index e4c7b83a4..a423915a2 100644 --- a/wp-admin/options-permalink.php +++ b/wp-admin/options-permalink.php @@ -75,36 +75,33 @@ include('admin-header.php'); $home_path = get_home_path(); $iis7_permalinks = iis7_supports_permalinks(); +$prefix = ''; +if ( ! got_mod_rewrite() && ! $iis7_permalinks ) + $prefix .= '/index.php'; +if ( is_multisite() && !is_subdomain_install() && is_main_site() ) + $prefix .= '/blog'; + if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) { check_admin_referer('update-permalink'); if ( isset( $_POST['permalink_structure'] ) ) { $permalink_structure = $_POST['permalink_structure']; - if ( ! empty( $permalink_structure ) ) { - $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); - if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) - $permalink_structure = '/blog' . $permalink_structure; - } + if ( ! empty( $permalink_structure ) ) + $permalink_structure = $prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) ); $wp_rewrite->set_permalink_structure( $permalink_structure ); } if ( isset( $_POST['category_base'] ) ) { $category_base = $_POST['category_base']; - if (! empty( $category_base ) ) { - $category_base = preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); - if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) - $category_base = '/blog' . $category_base; - } + if ( ! empty( $category_base ) ) + $category_base = $prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) ); $wp_rewrite->set_category_base( $category_base ); } if ( isset( $_POST['tag_base'] ) ) { $tag_base = $_POST['tag_base']; - if ( ! empty( $tag_base ) ) { - $tag_base = preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); - if ( is_multisite() && ! is_subdomain_install() && is_main_site() ) - $tag_base = '/blog' . $tag_base; - } + if ( ! empty( $tag_base ) ) + $tag_base = $prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) ); $wp_rewrite->set_tag_base( $tag_base ); } } @@ -166,16 +163,20 @@ if ( ! is_multisite() ) {

URLs which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A number of tags are available, and here are some examples to get you started.'); ?>

@@ -198,16 +199,12 @@ $structures = array( -