Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So the site content has file.jpg and needed to be rewritten to file.jpg.webp. Is it possible to use write and if so is this correct? Because I am not seeing the results

What I have tried:

<rewrite>
<rules>
<rule name="webp">
<match url="(.+)\.(jpe?g|png)$" ignorecase="false">
<conditions logicalgrouping="MatchAll">
<add input="{HTTP_ACCEPT}" pattern="image/webp" ignorecase="false">
<add input="{DOCUMENT_ROOT}/{R:0}.webp" matchtype="IsFile">

<action type="Rewrite" url="{R:0}.webp" logrewrittenurl="true">
<servervariables>
<set name="ACCEPTS_WEBP" value="true">



<outboundrules>
<rule name="Set Vary header" precondition="IsWebp">
<match servervariable="RESPONSE_Vary" pattern=".*">
<action type="Rewrite" value="Accept">

<preconditions>
<precondition name="IsWebp">
<add input="{ACCEPTS_WEBP}" pattern="true" ignorecase="false">
Posted
Updated 17-Sep-19 9:29am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900