Freigeben über


Redirecting a SharePoint Subsite or a Site collection to a different URL

Lots of times I have been asked this question if there is a way to redirect a subset to a different URL

I have seen many people trying this by playing around AAM and at the IIS level. I will try to put bit of light on both of them and will also show you a easy way out of it

1) AAM(Alternate Access Mapping)

This option will not work out as we cannot add Subsite URL in this. For Example we can add the following types of URL in the AAM

A) https://ServerName

B) https://FQDN

Now this is good if you want to do a redirect of the whole url where if browse to https://ServerNameA we are redirected to https://ServerNameB but this option will not help in redirecting a Subsite to a different URL

2) IIS Level

We can redirect a Virtual Dir with help of this. But SharePoint Subsite wont show up in IIS as they are stored in database. So one way we can think is create a Virtual dir of each URL you want to redirect then create exclusion in SharePoint and redirect it from IIS

Now if you several Subsites then this is a not a good option.

Following are the steps which will help us in redirecting any level of site in SharePoint in a pretty neat manner. We will try to redirect https://mosssps/sites/Team/default.aspx to https://mosssps

1) We will open the site in Web Folder view

clip_image002

2) Download default.aspx page of the site which we want to redirect. There are other ways to access default.aspx page too.

clip_image004

3) Open the default.aspx in notepad and delete all the contents of it

4) Add the following code to it

<%@ Page language="C#" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>

<script>

window.location.href = "https://mosssps/Pages/Default.aspx";

</script>

5) https://mosssps/Pages/Default.aspx is the URL where we want it to redirect if browse to https://mosssps/sites/Team/default.aspx

6) Upload the Default.aspx and now when you browse to https://mosssps/sites/Team/default.aspx it will redirect to https://mosssps/Pages/Default.aspx.

 

Note- I have only tested this on Moss.If you are intending to use this for V2 then you may wanna test this first

Comments