Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PHP site running on IIS7 and I need to add some URL rewriting, but so far it seems to be ignoring my rule. Here's the rule:

        <rule name="VCard" stopProcessing="true">
            <match url="\?user=(.*)$" />
            <action type="Rewrite" url="{R:1}" redirectType="Permanent" appendQueryString="false" logRewrittenUrl="true" />

When using the UI to test my regex, it says that does match the rule, and that R:1 is "123456". But when I try to access the actual url it doesn't appear to work.

The logging doesn't seem too helpful:

2010-10-26 14:22:07 XXX.XXX.XXX.XXX GET / user=12345 80 - XXX.XXX.XXX.XXX Mozilla/5.0 (Windows;+U;+Windows+NT+6.1;+en-US)+AppleWebKit/534.10 (KHTML,+like+Gecko)+Chrome/8.0.552.11+Safari/534.10 200 0 0 187

As I mentioned above, the site itself is in PHP (which I'm less familiar with hosting on IIS). Could that be preventing the rewriting module from running? Am I missing a critical step somewhere?

share|improve this question
up vote 1 down vote accepted

The url match is for just the URL before the querystring, like folder/vcard.aspx.

It's probably a condition for {QUERY_STRING} that you need instead. Set .* for the url if you want to catch everything. Just be careful you don't run into a loop for that query.

This may be helpful:

It shouldn't matter that it's PHP. The redirecting occurs before it processes PHP.

share|improve this answer

Your Answer


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.