Windows IIS 7.5 pseudo static Chinese URL address 404 error problem

Source: Internet
Author: User


Space migration, WordPress article in all the Chinese tag page access all reported 404 errors, Google search for a moment, learned that IIS7.5 pseudo static url_rewrite does not support Chinese, and finally in IIS7 WordPress Chinese URL Solution Blog to find a solution, especially thanks to the original author, here to share the solution, I hope to help later friends ~

Under the WordPress installation directory, create a new "chineseurl.php" file that reads as follows:

The code is as follows Copy Code

<?php

IIS Mod-rewrite
if (Isset ($_server[' Http_x_original_url ')) {
$_server[' Request_uri '] = $_server[' Http_x_original_url '];
}
IIS Isapi_rewrite
else if (isset ($_server[' Http_x_rewrite_url ')) {
$_server[' Request_uri '] = $_server[' Http_x_rewrite_url '];
}
Else
{
Use Orig_path_info if there no path_info
if (!isset ($_server[' path_info ')) && isset ($_server[' orig_path_info '])
$_server[' path_info '] = $_server[' orig_path_info '];

Some IIS + PHP configurations puts the script-name in the Path-info (No need to append it twice)
if (Isset ($_server[' path_info ')) {
if ($_server[' path_info '] = = $_server[' Script_name '])
$_server[' Request_uri '] = $_server[' path_info '];
Else
$_server[' Request_uri '] = $_server[' Script_name ']. $_server[' Path_info '];
}

Append the query string if it exists and isn ' t null
if (Isset ($_server[' query_string ')) &&!empty ($_server[' query_string ')) {
$_server[' Request_uri ']. = '? '. $_server[' query_string '];
}
}

Require ("index.php");

?>

Then add a rule to the Web.config and place the rule at the top of the rule collection:

The code is as follows Copy Code


<rule name= "Chineseurl" stopprocessing= "true" >
<match url= "/(Tag|category)/(. *)"/>
<action type= "Rewrite" url= "chineseurl.php"/>
</rule>

The effect is as follows

If WordPress is not mounted in the root directory, you will need to change the "<match url=" ^ (tag|category)/(. *) $ "/>" for "<match url=" ^ installation directory/(tag|category)/(. *) $ " /> ". If the default label prefix and category prefix (tag and category) are changed in the fixed link settings, change the corresponding content in this sentence.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.