Quantcast
Channel: All Forums
Viewing all articles
Browse latest Browse all 27852

Rules Error

$
0
0

Hi

I have an SSL certifcate assigned to "mysite.com" and all traffic through the site must be https. I want to have a rewrite rule which permanently redirects any of the following URL's tohttps://mysite.com

http://mysite.com

http://www.mysite.com

https://www.mysite.com

If the user has a bookmark to http://www.mysite.com/mypage.aspx, the URL rule would redirect tohttps://mysite.com/mypage.aspx

Here is what I have so far, except I get a certificate error if I type https://www.mysite.com, this part is driving me nuts...

<rewrite>
  <rules>
    <
rule name="Remove www">
        
<match url=".*" ignoreCase="true" />
       
<conditions logicalGrouping="MatchAll">
       
    <add input="{HTTP_HOST}" negate="true" pattern="^[^.]*mysite.*" />
          
<add input="{HTTP_HOST}" pattern="^www\.(.+)$" />
        
</conditions>
    
   <action type="Redirect" url="https://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent"/>
   
</rule>

    <rule
name="Https Processing" stopProcessing="true">
        <match
url=".*" ignoreCase="true" />
        <conditions>

           
<add input="{HTTPS}" pattern="Off" />
            <add
input="{HTTP_HOST}" pattern=".*" />
       
</conditions>
        <action type="Redirect" url="https://{C:0}/{R:0}" appendQueryString="true" redirectType="Permanent"/>
   
</rule>
 
</rules>
</rewrite>

If someone can point out where I might have missed something, or how I can optimize this rule.

Thanks, Craig


Viewing all articles
Browse latest Browse all 27852

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>