IIS 7.5 URL重写2.0到HTML页面
我有以下规则:IIS 7.5 URL重写2.0到HTML页面,iis,url-rewriting,iis-7.5,Iis,Url Rewriting,Iis 7.5,我有以下规则: <rewrite> <rules> <rule name="FlowURLs"> <match url="^flows/[_0-9a-zA-Z-]+/[_0-9a-zA-Z-]+/([._0-9a-zA-Z-]+)" /> <action type="Rewrite" url="music.html?flow={R:
<rewrite>
<rules>
<rule name="FlowURLs">
<match url="^flows/[_0-9a-zA-Z-]+/[_0-9a-zA-Z-]+/([._0-9a-zA-Z-]+)" />
<action type="Rewrite" url="music.html?flow={R:1}" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="^.*\.(ashx|axd|css|gif|png|jpg|jpeg|js|flv|f4v|html)$" negate="true" />
</conditions>
</rule>
</rules>
</rewrite>
我想将其改写为:
http://localhost/music.html?id=twit_nobone1354334226132.mp3
html驻留在根目录中,它有一个样式表、javascript和图像。我看到的问题是,当它重写时,没有显示图像、js或样式表。当我检查这些资源时,看起来链接现在已经被删除了
http://localhost/flows/t/twit_nobone/twit_nobone1354334226132.mp3/demo.css
http://localhost/flows/t/twit_nobone/twit_nobone1354334226132.mp3/images/screenshot.png
而不是
http://localhost/demo.css
http://localhost/images/screenshot.png
我做错了什么?我还注意到浏览器中的url从未更改为重写的url。您必须了解如何解决此问题 1:如果你想保持地址像http://localhost/flows/t/twit_nobone/twit_nobone1354334226132.mp3 然后确保music.html中的所有资源都是绝对链接的,所以不要使用test.css,而是从根服务器将其设置为/path/to/test.css。那就行了 2:如果你喜欢这样的地址 http://localhost/music.html?id=twit_nobone1354334226132.mp3 编辑 我刚刚发现它很简单-将操作更改为:
<action type="Redirect" redirectType="Found" url="music.html?flow={R:1}" />
<action type="Redirect" redirectType="Found" url="music.html?flow={R:1}" />