2

How to redirect users to

http://serverName/Page/default.aspx 

When they enter http://serverName/default.aspx

The first url opens root site, which shows all the contents in SharePoint Site. But I want users to be able to see only pages defined inside Page/default.aspx not the default Sharepoint root site.

Is there any out of box feature to solve this problem?

Thanks in advance.

2

Below are four ways to set another page as your home page: (all four work for both 2007 and 2010)

  1. From Site Settings (If the publishing features are enabled)

  2. From SharePoint Designer

  3. From code / API

  4. From PowerShell

The first two can be used by Site Owners, the second two can only be used for developers and administrators.

Site Settings (if the publishing features are enabled for a site):

Site Actions, Site Settings, Welcome Page

SharePoint Designer:

Right-click the new page and click “Set as Home Page”. (For SharePoint 2007 this only appears to work from SharePoint Designer if the file is in the root of the site. I.e. the same place as default.aspx.)

API:

C# and VB developers can use the SPFolder.WelcomePage property. See:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.welcomepage.aspx

PowerShell: for SharePoint 2010:

$site = Get-SPSite http://yourserver/sites/yoursite

$web = $site.RootWeb   (or $web = $site.OpenWeb(“yoursubsite”)

$folder = $web.RootFolder $folder.WelcomePage = “SitePages/home.aspx”

(or  $folder.WelcomePage = “default.aspx”)

(or  $folder.WelcomePage = “Shared%20Documents/mycustomwebpartpage.aspx”)

$folder.update()

$web.Dispose()

$site.Dispose()

for SharePoint 2007 (the first two lines are different):

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

$site = New-Object Microsoft.SharePoint.SPSite(“http://yourserver/sites/yoursite“)

$web = $site.RootWeb

(or $web = $site.OpenWeb(“yoursubsite”)

$folder = $web.RootFolder $folder.WelcomePage = “SitePages/home.aspx”

(or  $folder.WelcomePage = “default.aspx”)

(or  $folder.WelcomePage = “Shared%20Documents/mycustomwebpartpage.aspx”)

$folder.update()

$web.Dispose() $site.Dispose()
0

The simpler way to do is to set your landing page as "Serverurl/pages/default.aspx" and in the "serverurl/default.aspx" , add a content editor to redirect to home url by inserting a script .

You can set persmissions or delete the page which you want to hide it from all users .

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.