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(+ | ||
+ |
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.') ?>