Quantcast
Channel: SharePoint Diary
Viewing all articles
Browse latest Browse all 1058

How to Create Redirect (URL Shortcut) to a Subsite in SharePoint

$
0
0
Requirement:
We've a sub-site located at the URL - http://sharepoint.crescent.com/sites/marketing/regions/us/brandcenter/ and the requirement is to create a shortcut to this subsite. That is the URL shortcut: http://brandcenter.com should redirect to the above subsite.

Solution: To redirect to a subsite in sharepoint, lets use IIS HTTP Redirect module. Follow these steps to redirect to subsite.
Make sure HTTP Redirection module is installed before proceeding. If not, enable it from Server Manager!

Step 1: Create necessary DNS entries for your new host name.
To begin with, create DNS entries for your new host (in my case: http://brandcenter.com). It could be a HOST-A Record / Forward Lookup Zone / CNAME, etc based on your requirement. For testing purpose, you can make an entry in your HOST file (located at: C:\Windows\System32\drivers\etc)

Step 2: Create New IIS Web Site:
  • Go to IIS of your SharePoint Web front end server(s), Right click "Sites" node create a new site by choosing "Add Web Site"redirect sharepoint site to a subsite
  • Set the site name, Application Pool, Physical path accordingly. Host header as your new host name. Click on "Test Settings" button to make sure your application pool account is able to access the virtual directory and authentication works as expected.sharepoint 2010 redirect from root to subsite
Step 3: Configure HTTP Redirect Module in IIS
Now, Open the "HTTP Redirect" module from the IIS Site you have created.
sharepoint 2010 redirect from root to subsite
Enable "Redirect requests to this destination" check box and enter the full URL of your subsite. Enable "Redirect all requests to exact destination" check box also.
How to redirect to a subsite in sharepoint
Its also possible to use Tokens in the URL, such as: $S = Path, $Q = Query String.

That's all! Now, when a user hit http://brandcenter.com, they'll be redirected to: http://sharepoint.crescent.com/sites/marketing/regions/us/brandcenter/
Its also possible to manage all these things using the command line: AppCmd .Refer: http://blogs.msdn.com/b/mcsnoiwb/archive/2012/04/20/configure-redirect-via-iis-using-command-line-script.aspx

PowerShell script to set IIS HTTP Redirect:
import-module webAdministration

#Set these variables: Site name and Redirect URL
$SiteName = "BrandCenter"
$RedirectURL = "http://sharepoint.crescent.com/sites/marketing/regions/us/brandcenter/"

# Set the redirect
Set-WebConfiguration system.webServer/httpRedirect "IIS:\sites\$siteName" -Value @{enabled="true";destination="$RedirectURL";exactDestination="true";httpResponseStatus="Found"}
This trick works on SharePoint 2007, SharePoint 2013 and SharePoint 2010 to redirect to sub site URL.

Viewing all articles
Browse latest Browse all 1058

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>