IIS 7.0 URL Rewrite Module - Root URL doesn't display

﹥>﹥吖頭↗ 提交于 2020-01-16 05:04:07

问题


I'm trying to setup a PHP website in IIS 7.0 with URL rewriting enabled using this module (http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1691)

I've got the whole thing running fine for inner pages of the site, but my root URL "/" doesn't work any more.

I want the structure of my URLs to be www.test.com/test-page.html and this is rewritten to www.test.com/index.php?page=test-page

The rule that I have specified is as follows:

Regular expression to match : ^([^/.]+)/?.html Rewrite to: /index.php?page={R:1}

as I said it works fine for all the inner pages so www.test.com/test-page.html would load no problem, it is just the homepage, www.test.com that doesn't work.

Any help would be much appreciated, I'm assuming that I need to add some sort of extra condition?


回答1:


try ^(?:([^/.]+).html)?$

this will make the entire check for: 1 or many characters not / or not . followed by .html optional.



来源:https://stackoverflow.com/questions/1119936/iis-7-0-url-rewrite-module-root-url-doesnt-display

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!