简体   繁体   中英

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 )

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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