Windows IIS 7.5 false static Chinese URL address 404 error

Source: Internet
Author: User

In the following article, the wordpress public iis7 to iis7.5 all use the tag Chinese url with the 404 error. Let's take a look at the solution to this problem.


After the space migration, 404 error is reported when accessing all the Chinese tag pages in the WordPress article. After a Google search, I found that IIS7.5 pseudo static URL_Rewrite does not support Chinese characters, finally, I found a solution in the IIS7 WordPress Chinese URL solution blog. I would like to thank the author of the original article for sharing the solution here, hoping to help my friends later ~

In the WordPress installation directory, create a "chineseurl. php" file with the following content:

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 is no PATH_INFO
If (! Isset ($ _ SERVER ['path _ info']) & isset ($ _ SERVER ['orig _ PATH_INFO '])
$ _ SERVER ['path _ info'] = $ _ SERVER ['orig _ PATH_INFO '];

// Some IIS + PHP comprehensions 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 ");

?>

Add a rule in web. config and place it at the top of the rule set:

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 installed in the root directory, you need to change "<match url =" ^ (tag | category )/(. *) $ "/>" is "<match url =" ^ installation directory/(tag | category )/(. *) $ "/> ". If you change the default tag prefix and category directory prefix (tag and category) in the fixed link settings, you can change the corresponding content in this sentence.

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.