Reputation: 257
How can I rewrite this url in IIS
mysite.com/profile.aspx?user=foo
to
mysite.com/foo
This rewrite condition I've tried in .htaccess
RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE]
But how can I do it in IIS Url Rewrite?
Upvotes: 1
Views: 534
Reputation: 21989
Quite simply:
<rule name="Profile Rewrite" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="isFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="isDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="profile.aspx?user={R:1}" />
</rule>
Note that your Apache rewrite rule won't actually do what you expect at all. Also note that you can easily generate this from the URL Rewrite visual configure tool within IIS Manager.
Upvotes: 1