Windows Azure: redirect website from www to non-www -
i have web.config
file on server.
<rewrite> <rules> <rule name="http https redirect" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="off" ignorecase="true" /> </conditions> <action type="redirect" redirecttype="found" url="https://{http_host}/{r:1}" /> </rule> <rule name="rule" stopprocessing="true"> <match url="^(.*)$" ignorecase="false" /> <conditions> <add input="{request_filename}" matchtype="isfile" ignorecase="false" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" ignorecase="false" negate="true" /> <add input="{url}" pattern="^/favicon.ico$" ignorecase="false" negate="true" /> </conditions> <action type="rewrite" url="index.php/{r:1}" appendquerystring="true" /> </rule> </rules> </rewrite>
i want redirect url www non-www. example, if user types www.exmaple.com
, should go https://example.com
how can edit such thing in above code. thanks.
you can have way (i've merge https/non-www rules in 1 rule)
<rule name="https , non-www only" stopprocessing="true"> <match url="^(.*)$" /> <conditions logicalgrouping="matchany"> <add input="{https}" pattern="off" ignorecase="true" /> <add input="{http_host}" pattern="^www\." ignorecase="true" /> </conditions> <action type="redirect" redirecttype="found" url="https://example.com/{r:1}" /> </rule> <rule name="generic default rule" stopprocessing="true"> <match url="^(.*)$" /> <conditions> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> <add input="{request_uri}" pattern="^/favicon\.ico$" ignorecase="true" negate="true" /> </conditions> <action type="rewrite" url="/index.php/{r:1}" appendquerystring="true" /> </rule>
Comments
Post a Comment