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.