I'm using ASP.NET 3.5 with IIS 7 with the URL Rewrite Module 2.0 installed.
When I create the first test rewrite rule:
<rewrite> <rules> <rule name="Test rule1" patternSyntax="ExactMatch"> <match url="w/123/test" /> <action type="Rewrite" url="article.aspx?id=123" /> </rule> </rules> </rewrite>
It works perfectly (http://www.myapp.com/w/123/test -> http://www.myapp.com/article.aspx?id=123).
BUT, when I try to use it on a domain that I own, it doesn't work. I assume that something in my syntax is wrong. Here is what i'm trying to do:
<rule name="Test Rule2" patternSyntax="ExactMatch"> <match url="http://www.my-domain.com" /> <action type="Rewrite" url="article.aspx?id=123" /> </rule>
When I try to browse http://www.my-domain.com
I expect to be redirected to the article.aspx
page, which I don't, I just get 404 page not found.
How should I write a rule for a domain and not for a path ?
Thanks in advance, Gal.
<rewrite>
<rules>
<rule name="static_file_auto_version">
<match url="^/(scripts|styles|images)/(.*?)\.[0-9]+\.(css|js|gif|png|jpg)" />
<action type="Rewrite" url="/{R:1}/{R:2}\.{R:3}" />
</rule>
</rules>
</rewrite>
可我访问http://localhost/styles/base-mini.222.css还是返回404
安装URL Rewrite 组件可以直接在iis管理器里面去添加规则!不错
iis7在eb.config里弄重定向,感觉还是挺方便的