Sitecore URL Rewrite and Redirect using IIS rewrite module

There are many Sitecore URL redirect modules for 301 redirections and URL Rewrite modules in Sitecore Marketplace which you need to install separately. This article demonstrates  Sitecore URL Rewrite and Redirect using IIS rewrite module which is traditional .NET approach.

Sitecore URL Rewrite and Redirect using IIS rewrite module

Follow the detailed steps to perform URL Rewrite and 301 redirects in Sitecore without writing any code.

#1. Install URL Rewrite 2.0 Module from the Microsoft. There are different versions for x64 and x86. Download and install it according to the OS and IIS installed.

#2. Once the installation is done, Go to IIS Manager and verify for the URL Rewrite icon. If the installation is success then you will see the URL rewrite icon in the IIS.

#3. Create a config file RewriteRules.config in the App_Config folder of Sitecore. Add all the Rewrite rules in this file.

#4. For Redirections, you could create a file called as RewriteMaps.config in the App_Config folder of Sitecore. Add all the static redirections and rewrite maps in this config file.

#5. Open the web.config in the root folder and add the below lines to make it work. Just add these lines above the closing tag of </system.webServer>

      <rewriteMaps configSource="App_Config\rewritemaps.config" />
      <rules configSource="App_Config\RewriteRules.config" />

#6. Restart the IIS and the URL rewrite and redirects should work like a charm. You do not have to install any Modules, or write any code.

Sitecore URL Redirect and Rewrite Example:


<?xml version="1.0" encoding="utf-8"?>
<rule name="Redirect rules" patternSyntax="ECMAScript" stopProcessing="true">
    <match url=".*" ignoreCase="true"  />
    <conditions trackAllCaptures="true">
      <add input="{MyRedirects:{REQUEST_URI}}" pattern="(.+)" />
      <add input="{HTTP_HOST}" pattern="^(www.)?$" />
    <action type="Redirect" url="{C:0}" appendQueryString="false" redirectType="Permanent" />


<?xml version="1.0" encoding="utf-8" ?>
   <rewriteMap  name="MyRedirects"  >
    <add key="/home.html"  value="/home.aspx"/>
    <add key="/about-us.html"  value="/about-us"/>


      <rewriteMaps configSource="App_Config\rewritemaps.config" />
      <rules configSource="App_Config\RewriteRules.config" />
Leave a Reply

Your email address will not be published.

Sign Up for Our Newsletters

Get notified of the best deals on our WordPress themes.

You May Also Like
[Solved] Err_Http2_Protocol_Error

[Solved] err_http2_protocol_error

Table of Contents Hide Solution err_http2_protocol_errorScenario 1: Low Disk SpaceScenario 2: Gzip double compressionScenario 3: Failed to load resource: net::ERR_HTTP2_PROTOCOL_ERROR after upgrading to VS 2019 16.10.0 (and 16.10.1) The err_http2_protocol_error…
View Post

Javascript URLEncode

Let us take a look at what would be the best approach for Encoding URL using Javascript. There are basically 3 Javascript URLEncode methods available. Types of Javascript URLEncode escape()…
View Post