views:

235

answers:

1

Hi,

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  A: 

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

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

Martijn Laarman
Mr Laarman, you are officially my favourite person in the whole world. Thanks for your help
bradfields
Cheers! Don't forget to accept my answer and upvote it and you'll be my favorite person as well! In all seriousness though glad to hear that worked out for you :)
Martijn Laarman