I am working on Sitecore project and using 301 redirect for our website. Right now our redirect chain is

http://example.com/ >> http://www.example.com >> https://www.example.com >> https://www.example.com/en

Our company recommendation is to change it in one redirect Example.

http://example.com/ >> https://www.example.com/en

http://www.example.com >> https://www.example.com/en

https://www.example.com >> https://www.example.com/en

Is there any way that I can achieve this requirement with Sitecore or IIS URL Rewrite? If yes then How? Thank you for any small help.

3 Answers 3


Yes, You can achieve this requirement through Sitecore 301 Redirect Module or IIS URL Rewrite both.

Paste the below Code inside your <system.webServer></system.webServer> element in the web.config

    <rule name="Redirect Maps Rule" stopProcessing="true">
      <match url=".*" />
        <add input="{StaticRedirects:{PATH_INFO}}" pattern="(.+)" />
      <action type="Redirect" url="{C:1}" appendQueryString="True" redirectType="Permanent" />
    <rewriteMap name="StaticRedirects">
      <add key="http://example.com" value="https://www.example.com/en" />
<add key="http://www.example.com" value="https://www.example.com/en" />
<add key="https://www.example.com" value="https://www.example.com/en" />


Below is the link, from where you can easily generate the IIS 301 redirection rules online :


I hope this will help you.


Well in any case you will have to bind example.com as well as www.example.com on your website.

Next you have multiple options. Either use IIS Rewrite rules.

<rule name="Root Hit Force HTTPS Redirection" enabled="true" stopProcessing="true">
  <match url="^$" ignoreCase="false" />
    <add input="{HTTPS}" pattern="^OFF$" />
    <add input="{HTTP_METHOD}" pattern="GET" />
  <action type="Redirect" url="https://{HTTP_HOST}/" redirectType="Permanent" />

and for www redirection

<rule name="Redirect example.com to www" stopProcessing="true">
  <match url="^(.*)" />
    <add input="{HTTP_HOST}" pattern="^example\.com$" />
  <action type="Redirect" url="https://www.example.com/{R:0}" redirectType="Permanent" />

Another possibility is to use the redirect module that comes with SXA.

And finally, you could use something from the marketplace. https://marketplace.sitecore.net/en/Modules/3/301_Redirect_module.aspx


You can write your own re-write rule:


It is not related to the Sitecore. If you want to handle inside the Sitecore, you have to use rewrite rule module available on the Sitecore Marketplace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.