From 16256fd828757558af70ca03c2d6f6a980966e66 Mon Sep 17 00:00:00 2001
From: Dion Hulse
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: https://develop.svn.wordpress.org/trunk@14051 602fd350-edb4-49c9-b593-d223f7449a82
---
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 e4c7b83a4e..a423915a23 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(
-
- checked="checked"
-
- />
+ />
-
+
@@ -223,11 +220,11 @@ $structures = array(
@@ -239,7 +236,7 @@ $structures = array(
-
web.config file were writable , we could do this automatically, but it isn’t so this is the url rewrite rule you should have in your web.config
file. Click in the field and press CTRL + a to select all. Then insert this rule inside of the /<configuration>/<system.webServer>/<rewrite>/<rules>
element in web.config
file.') ?>