1

I have created a root site collection with following http://sp.domain.com

I want to auto redirect all users who browse to the root site collection to another site collection with this http://sp.domain.com/test1 so that nobody can use root site collection.

Note: I don't want to Add content editor web part method adding script to webpart What can be the best solution.

Thanks for advices.

  • why you dont want user use the root site collection and why cant user directly go to 2nd site collection? – Waqas Sarwar MVP Jun 20 '14 at 18:53
2

Alternative 1: You can re-design the logical structure of web applications and site collection in your farm by introducing host-named site collections, which allows you to configure a host header at the site collection level within a single web application. The approach would let you get an independent URL to the site collection, if this is what you want. (Recommended)

Alternative 2: URL Rewrite Module (as suggested by Unnie) will get you permanent redirects but check its usage restrictions

Alternative 3: You simply skip adding content editor web part and script on start page often called default.aspx. Instead you replace the mark-up of default.aspx (start page) of the root site collection with following:

<!DOCTYPE html>
<html>
<head>
<META http-equiv="refresh" content="0;URL=http://sp.domain.com/test1">
</head>
<body>
</body>
</html>
1

You can use URL Rewrite to perform redirection from the IIS. This way you can avoid writing redirection code in your master page, webpart etc which is not efficient.

  1. Download and install URL rewrite module in your server. The module will be available in IIS manager after installation.Download from here

  2. Write rule to redirect request from http://sp.domain.com to http://sp.domain.com/test1 .

See this blog for redirect from one site collection to another.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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