IIS7 URL Rewrite - Rewrite CSS files
Posted
by
user1231958
on Server Fault
See other posts from Server Fault
or by user1231958
Published on 2012-10-24T02:05:04Z
Indexed on
2012/10/24
5:09 UTC
Read the original article
Hit count: 505
I'm trying to rewrite certain CSS files with some rules, so it replaces every single instance of links in the CSS (as in background: url("/myuri.jpg")
) with a prefix (as in background: url("/zeus/myuri.jpg")
)
These are the rules.
<rule name="ReverseProxyOutboundRule2" preCondition="IsCSS" enabled="true" stopProcessing="false">
<match filterByTags="None" pattern="url\("(.*)"\)" />
<action type="Rewrite" value="url("/zeus{R:1}")" />
<conditions>
<add input="{URL}" pattern="/zeus" />
</conditions>
</rule>
<preCondition name="IsCSS">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/css" />
</preCondition>
However, only one url is being replaced this way and somehow the rest is being ignored.
Thank you beforehand.
© Server Fault or respective owner