Search code examples
htmlasp.netweb-confighttp-redirecturl-rewrite-module

Https redirection changes to wrong url path


I have been trying to convert my http web links to https using rewrite module. The redirection seems to partially work as the links are converted with https, but then the target url is not as expected.

That is, the original url: http://servername/folder/page_x.aspx But the converted url drops 'folder' from the path: : https://servername/page_x.aspx

Any help or direction towards the fix is highly appreciated!


Solution

  • It can be cause it is forcing a default pattern, if you have not specified one here:

    <conditions>
    <add input="{HTTPS}" pattern="off" />
    </conditions>
    

    It can be because of redirect type such as the example down below:

    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />