Rewrite URL in IIS7 .NET MVC
I'm trying to rewrite the url:
开发者_开发百科https://mydomain/phone-append
to
https://mydomain/Service/PhoneAppend
using the following rule:
<rewrite>
<rules>
<rule name="Phone Append">
<match url="phone-append" />
<action type="Rewrite" url="/Services/Index" appendQueryString="true" />
</rule>
</rules>
</rewrite>
The rule works fine if the rewrite url is /Services but when I change it to /Services/PhoneAppend I get a page not found error. I've been pulling my hair out for a couple hours. Any ideas?
Thanks, Chris
I would recommend using Failed Request Tracing to troubleshoot the failure: http://learn.iis.net/page.aspx/467/using-failed-request-tracing-to-trace-rewrite-rules/
I cant see why it would not work, the rule above says that it will match (using Regular Expressions) any URL that contains phone-append on it, and rewrite to /Services/Index passing the query string.
If you use Failed Request TRacing you will see the details of the rewrite.
finally if you cant figure it out, URL Rewrite team answers a lot of questions at forums.iis.net
精彩评论