Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to configure IIS7 (Windows Server 2008) so that I can use URL's that do not include the file extension (i.e. somepage.php would become http://DOMAIN/somepage)

I'm using the URL rewrite tool in IIS7, and have the following rule:

Match URL

Requested URL - Matches the pattern

Using: Wildcards

Pattern: /*

No conditions.

Action

Action Type: Rewrite

Action properties - Rewrite URL: {R:1}.php, append query string

It's returning a 404 error. When I use the Test Pattern tool, it appears to work, and R:1 is what I want to add before the file extension. Any help or ideas would be greatly appreciated!

Thanks!

share|improve this question

migrated from stackoverflow.com Aug 21 '09 at 15:02

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 4 down vote accepted

You need to change the rule to use regular expressions instead of wildcards. This is because the R:1 is a regexp backreference.

Also - you probably want your pattern to be (.*) for it to be R:1 (most likely it will be R:0 without the parens - R:0 is the backreference for "the entire match")

Check out http://learn.iis.net/page.aspx/497/user-friendly-url---rule-template/ for lots of info on the user friendly URL portion of URL Rewrite.

share|improve this answer
    
Thanks, this worked. –  Matt Sep 4 '09 at 21:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.