Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Saied 349 posts 674 karma points
    Feb 01, 2016 @ 21:26
    Saied
    0

    UrlRewriting.config not redirecting to from http to https

    I have the following rules in my UrlRewriting.config:

    <add name="sctCanonical" virtualUrl="http:// sctflash.com/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.sctflash.com/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    
    <add name="bdCanonical" virtualUrl="http:// bullydog.com/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.bullydog.com/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    
    
    <add name="rewriteFolderSlashes" virtualUrl="^~/((?!umbraco/).[^?]*)/$" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/$1" redirect="Application" ignoreCase="true" redirectMode="Permanent" />
    

    I am trying to redirect the user to https:\\www.sctflash.com for example, but when I type in www.sctflash.com, it does not or when I type in http:\\www.sctflash.com, it doesn't either. I thought adding making the destination url "https://www.sctflash.com/$1" would work, but it doesn't?

    Changing it to the following works, but why, also will these still put www in front of non-www urls:

    <add name="sctCanonical" virtualUrl="http://(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="https://$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    
    <add name="bdCanonical" virtualUrl="http://(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" 
    

    destinationUrl="https://$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />

    Do I also have to change the cultures and hostnames to from http:\\www.sctflash.com to https:\\www.sctflash.com?

    Looks like changing my desintationUrl does not rewrite to www, but it does https. How can I keep both?

    Not sure if this is the right way, but I ended up using 2 rules, one to rewrite to www and the other to rewrite to https:

    <add name="sctCanonical" virtualUrl="http://sctflash.com/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.sctflash.com/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    
    <add name="bdCanonical" virtualUrl="http://bullydog.com/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.bullydog.com/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    
    <add name="sctHTTPS" virtualUrl="http://www.sctflash.com/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="https://www.sctflash.com/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    
    <add name="bdHTTPS" virtualUrl="http://www.bullydog.com/(.*)" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="https://www.bullydog.com/$1" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies