简体   繁体   English

IIS 7.0 URL重写模块-根URL不显示

[英]IIS 7.0 URL Rewrite Module - Root URL doesn't display

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 ) 我正在尝试在IIS 7.0中设置一个PHP网站,并使用此模块启用URL重写( 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. 我的整个网站的内部页面运行正常,但是我的根URL“ /”不再起作用。

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 我希望URL的结构为www.test.com/test-page.html,并将其重写为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} 要匹配的正则表达式:^([^ /。] +)/ ?. html重写为:/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. 正如我说的那样,它对所有内部页面都适用,因此www.test.com/test-page.html不会加载任何问题,只是首页www.test.com无法正常工作。

Any help would be much appreciated, I'm assuming that I need to add some sort of extra condition? 任何帮助将不胜感激,我假设我需要添加某种额外条件?

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

this will make the entire check for: 1 or many characters not / or not . 这将使整个检查: 1个或多个字符不是/或不是。 followed by .html optional. 然后是.html可选。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM