Http to https redirection in Asp.net through web.config -
i using rule in web.config file redirect url non www www
<rewrite> <rules> <rule name="imported rule 1" stopprocessing="true"> <match url="^(.*)$" ignorecase="false" /> <conditions logicalgrouping="matchall"> <add input="{http_host}" pattern="^www\.example\.com$" negate="true" /> </conditions> <action type="redirect" url="http://www.example.com/{r:1}" redirecttype="permanent" /> </rule> </rules> </rewrite>
now need migrate/redirect website http https. have rule implement.
<rule name="http https redirect" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="off" ignorecase="true" /> </conditions> <action type="redirect" redirecttype="permanent" url="https://{http_host}/{r:1}" /> </rule>
should need add both rules 1 after achieve both conditions or there single piece of code available. redirecttype should "permanent". have maintain seo of current website website seo should not go worse.
Comments
Post a Comment