When user goes to http://site/web/
I do not want them to be redirected to that web's welcome page, http://site/web/pages/default.aspx
.
How can I disable this redirection?
I am fully aware this would result in a 404 error which is what I want.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityWhen user goes to http://site/web/
I do not want them to be redirected to that web's welcome page, http://site/web/pages/default.aspx
.
How can I disable this redirection?
I am fully aware this would result in a 404 error which is what I want.
Here is what I came up with:
web.AllowUnsafeUpdates = true;
SPFolder rootFolder = web.RootFolder;
rootFolder.WelcomePage = "";
rootFolder.Update();
web.AllowUnsafeUpdates = false;
This works great. Will probably add this snippet to an event receiver when new webs are created.
Note: Setting the Welcome Page to nothing (""
) can only be done pragmatically. The /_Layouts/AreaWelcomePage.aspx
page won't let you do this.
you can also open up SharePoint designer. Create a new page, right click, select "set as home page", then delete the page.
Edit
Be sure to create the page at the root of the site and not in "pages" or you will still get /pages in the URL (although it will still throw a 404).