locked
rewrite url from https to https on different domain name RRS feed

  • Question

  • User-1942926485 posted

    Hello,

    im trying to redirect/rewrite a url that is on https.

    Im tying to make the url https://www.example.com/docs to redirect to https://www.eexxaa.com/documents.

    Is that possible to do it in IIS 7? I have tryied to do it using module rewrite but without any success till now.

    Can someone help please?

    Thank you

    Tuesday, May 20, 2014 6:02 AM

All replies

  • User-76669496 posted

    Hi,

    Something like this should work:

    <rule name="folder redirect" stopProcessing="true">

        <match url="oldfolder/(.*)" />

        <action type="Redirect" url="http://newdomain.com/newfolder/{R:1}" appendQueryString="true" />

    </rule>

    Tuesday, May 20, 2014 12:57 PM
  • User1183424175 posted

    Hi,

    Yes, it can work in iis 7. Please refer to the rule below:

     <rule name="rewrite new folder" stopProcessing="true">
          <match url="docs(.*)" />
          <conditions>
              <add input="{HTTP_HOST}" pattern="^www\.example\.com$" />
              <add input="{HTTPS}" pattern="^ON$" /> 
          </conditions>
          <action type="Redirect" url="https://www.eexxaa.com/documents/{R:1}" redirectType="Permanent" />  
     </rule>
    

    For more infromation, you can refer here

    http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

    Hope it can help you.

    Tuesday, May 20, 2014 11:28 PM
  • User-1942926485 posted

    Hi Peter, thank you for your reply. Is working for http but not for https to https. Any recommendations?

    Wednesday, May 21, 2014 6:49 AM
  • User-1942926485 posted

    Hi Pengzhen ,

    i tried your rule, is working on http but i havent manage to redirect https to https. Is it something additional required?

    here is the rule as i have it now:

     </rule>
    		     <rule name="rewrite new folder" stopProcessing="true">
          <match url="docs/(.*)" />
          <conditions>
                            <add input="{HTTP_HOST}" pattern="^example\.com$" />
                            <add input="{HTTPS}" pattern="^ON$" /> 
          </conditions>
          <action type="Redirect" url="https://www.eexxaa/documents/" redirectType="Permanent" />  
     </rule>

    Wednesday, May 21, 2014 6:56 AM
  • User1183424175 posted

    Hi,

    I find you set the host_name pattern as "example.com" instead of www.example.com. Please make sure it is right. And I think you can enable Failed Request tracing in iis to troubleshoot it. For more information, you can refer here

    http://www.iis.net/learn/extensions/url-rewrite-module/using-failed-request-tracing-to-trace-rewrite-rules

    In addition, you can try changing the condition in the rule like this:

    <conditions>
           <add input="{SERVER_PORT}" pattern="^443$" />
    and hostname condition here </conditions>

    Monday, May 26, 2014 7:08 AM