Tuesday, November 4, 2014

WordPress 4.0 on IIS 7.X, Permalinks dead loop for hybird unicoed urls

Just helped my friend did the migration from LAMP to IIS7, with fastcgi module. all smoothly, and based on the tutorial. on the platform of IIS, you don’t have the .htaccess rule, install a url rewrite2 module instead.

http://www.microsoft.com/web/gallery/install.aspx?appid=urlrewrite2

on the root of the web app, put the rewrite rules there , which will intercept all permallinks or friendly url which is neither a folder or file , and redirect them to the index.php to handle. so the code looks like this.

image

after this, one the wp settings page, you can turn on the friendly url .
image

now, when you go to some page with url like page-你好 , or post-ヤフオク, basically english and unicode in url combined, you will see server no response issue.

image

and when you put some page like hello-你好.html, on iis foder, it works. so IIS is fine, something wrong with the PHP to handle the unicode urls.

fix is here, basically , send the correct unicode url to php by the url-rewrite module. replease the request_uri with unicodeurl
http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference

here is the updated web.config for the rules.
image

after the change, all back to normal.

 
Locations of visitors to this page