I need help with a question about URL Rewrite.
Currently the redirection rule below works correctly.
<rule name="test_redirect" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^name.domain.com$" />
<add input="{HTTPS_HOST}" pattern="^name.domain.com$" />
</conditions>
<action type="Redirect" url="http://IP address/service" redirectType="Permanent" />
</rule>
Now what I need is that the browser's address bar still displays the original url.
(Example: "http://name.domain.com" redirects to "http://IP address/service" but the browser's address bar still displays "http://name.domain.com".)
So, I made the following configuration change:
<rule name="test_redirect" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^name.domain.com$" />
<add input="{HTTPS_HOST}" pattern="^name.domain.com$" />
</conditions>
<action type="Rewrite" url="http://IP address/service" redirectType="Permanent" />
</rule>
But didn't it work:
- The page loaded with an error.
- The "/service" has been added to the original URL.
Where is the error? Are there some configuration missing?
Can anyone help me with this?
Thanks. - Firstly, I installed the ARR module: (https://www.iis.net/downloads/microsoft/application-request-routing).
- After the installation is complete, I opened it at the IIS server level, selected "Server Proxy Settings", and checked "Enable proxy".
- I changed "action type="Redirect" to "action type="Rewrite".
The IIS version is 10.0.17763.1 on Windows Server 2019 Datacenter.
Among the iis server variables, there is no server variable
{HTTPS_HOST}.Please remove this from
<conditions>and try again.