I have a somewhat strange request: we need to rewrite a single url (eg: https://inbound.domain.com/index.php) to another (eg: http://outbound.local.com/register.php)
Any other request for a page should ideally be dropped..
This internal page references other resources on the same server (eg images are located in outbound.local.com/images/.
We have other sites running fine through URL rewrite, but I can't figure out how to filter/limit for a single page...
I tried setting inbound pattern to "https://inbound.domain.com/index.php" and rewrite URl to "http://outbound.local.com/register.php" but this ends up in a 404 not found..
We're running IIS10/url rewrite 2.0
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="https://inbound.domain.com/index.php" /> <action type="Rewrite" url="http://outbound.local.com/register.php" appendQueryString="false" logRewrittenUrl="true" /> <serverVariables> <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" /> <set name="HTTP_ACCEPT_ENCODING" value="" /> </serverVariables> </rule> </rules> <outboundRules> <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1"> <match filterByTags="A, Form, Img" pattern="^http(s)?://outbound.local.com/(.*)" /> <action type="Rewrite" value="https://inbound.domain.com/{R:2}" /> </rule> <rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding"> <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" /> <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" /> </rule> <rule name="Deal with href tags" preCondition="ResponseIsHtml1"> <match filterByTags="None" pattern="href=(.*?)http://outbound.local.com/(.*?)\s" /> <action type="Rewrite" value="href={R:1}https://inbound.domain.com/{R:2}" /> </rule> <rule name="Deal with action tags" preCondition="ResponseIsHtml1"> <match filterByTags="None" pattern="action=(.*?)http://outbound.local.com/(.*?)\\" /> <action type="Rewrite" value="action={R:1}https://inbound.domain.com/{R:2}\" /> </rule> <preConditions> <preCondition name="ResponseIsHtml1"> <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/(.+)" /> </preCondition> <preCondition name="NeedsRestoringAcceptEncoding"> <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" /> </preCondition> </preConditions> </outboundRules> </rewrite> </system.webServer> </configuration>