I'm trying to set up urlrewrite for my API. Now my site is like:
cookhamburger.php?topping=mayo&how=grill
cookpasta.php?topping=ragu&how=aldente
Given I have many utilities already bound to theese urls I want to stay compatible, but also I want to extend my site.
hence I made a generic handler that takes the "food" as a parameter
cooksomething.php?what=pasta&topping=ragu&how=aldente
to achive this I have to remap old urls to the new handler using a regex like
cook(.*)\.php\?(.*)
to match it and a remap like the following
cooksomething.php?what={R:1}&{R:2}
Now my issue is that once I go to the url:
http://localhost/cookhamburger.php?topping=mayo&how=grill
I got an error
Modulo «module» IIS Web Core
Notifica MapRequestHandler
Gestore «handler» PHP
Codice errore «error» 0x80070002
this is my web.config for the broken configuration:
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Handler remap" stopProcessing="true">
<match url="^cook(.*)\.php\?(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="cooksomething.php?what={R:1}&{R:2}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
but the following remap, for example,
(.*)\?(.*)
cooksomething.php?{R:1}&{R:2}
/hamburger?topping=mayo
works
User contributions licensed under CC BY-SA 3.0