Loading...

Sitecore 301 Redirect Module in a multi site setup

Let's get straight to it. You have a multi site Sitecore solution and you need to setup 301 redirects for one or many of your sites. This is one way to do it quickly in Sitecore. In the example below I am using Sitecore 8.1.3 and 301 Redirect Module v1.6

Let's start

Let's assume we have DEV, QA and PROD environments and these are the urls for site1 for each environment.

DEV -> http://dev.site1.org

QA -> http://qa.site1.org

PROD -> http://www.site1.org

All the other sites are following the same pattern as above.

Step 1

Download and install Sitecore 301 Redirect Module v1.6 or later @ https://marketplace.sitecore.net/Modules/301_Redirect_module.aspx?sc_lang=en

Step 2

In the Redirects Module / Redirects folder create a new folder Sites and then add a folder for each one of your sites. As far as 301 Redirect Module is concerned the folder structure is irrelevant. We are organizing our redirects so we can manage them easily. Here is a screenshot of what it could look like.

Step 3

We are going to use a theoretical site2 for our sample. To add a 301 redirect for site2 do the following:

  1. Right click on Site 2 and select Insert > Redirect Pattern
  2. In Requested Expression field add the following ^(.*)site2.org/about/default.aspx$
  3. In Response Status Code select 301 Moved Permanently
  4. In Source Item it is important to select a valid item path to the page we are redirecting. If the Source Item path is invalid (item does not exist) it will throw a regular 404 exception

Summary

So basically, you create a folder for each site and then add Redirect Pattern redirect under each site as needed. Obviously, you make sure you use url that is relevant to your sites. I am using site2 as an example here.

Let me know if you have any questions. I know this is pretty easy :)

Disclaimer
This is a personal blog. The opinions expressed here represent my own and not those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.. In addition, my thoughts and opinions change from time to time I consider this a necessary consequence of having an open mind. This blog disclaimer is subject to change at anytime without notifications.