Thread:Project:Support desk/Too many redirections error on Windows IIS 7

My wiki worked fine until I added url rewrite rules and tried to make the url "pretty".

My mediawiki is installed in C:\inetpub\mediawiki\w, ie. I have C:\inetpub\mediawiki\w\LocalSettings.php.

In IIS, the physical path of the website is C:\inetpub\mediawiki. Therefore I can access my wiki at http://www.example.com/w/. Main page is at http://www.example.com/w/index.php?title=首页(Main Page).

Now I want to add url rewrite so that the url of my wiki looks like ones of Wikipedia, http://www.example.com/wiki/首页(Main Page).

I'm following Manual:Short_URL/IIS7.

In LocalSettings.php I have

The rewrite rule of the website is

pattern: ^wiki/(.*)$ rewrite url: w/index.php?title={R:1}

I don't know whether the above is recommended setting or not, but I know one bad idea is to install wiki at root directory of a website. If I didn't do it in recommended way, I'm free to change it.

After this configuration, I can still access my wiki through http://www.example.com/w/index.php?title=首页, and the links of the webpage becomes, for example, http://www.example.com/wiki/特殊%3A上传文件(Special: Upload Files).

Then I try to access through http://mediawiki.gqqnbig.me/wiki/首页(Main Page). The browser tells me the error "Too many redirections".

This is the HTTP request and response: GET /wiki/%E9%A6%96%E9%A1%B5 HTTP/1.1 Host: mediawiki.gqqnbig.me Connection: keep-alive Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/539.36 Accept-Encoding: gzip, deflate, sdch Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4 Cookie: ...

HTTP/1.1 301 Moved Permanently Cache-Control: private, must-revalidate, max-age=0 Content-Type: text/html; charset=UTF-8 Expires: Thu, 01 Jan 1970 00:00:00 GMT Last-Modified: Tue, 30 Dec 2014 20:04:15 GMT Location: http://mediawiki.gqqnbig.me/wiki/%E9%A6%96%E9%A1%B5 Vary: Accept-Encoding, Cookie Server: Microsoft-IIS/7.0 X-Powered-By: PHP/5.4.24 X-Content-Type-Options: nosniff X-Powered-By: ASP.NET Date: Tue, 30 Dec 2014 20:04:15 GMT Content-Length: 174

How should I fix the error and keep using "pretty" url?