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.