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.

  • 3
    Could you just set the welcome page to a custom error page? – RJ Cuthbertson Jan 18 '13 at 18:35
  • This would still redirect. I want to disable this redirection altogether. – iambriansreed Jan 18 '13 at 18:53
  • I know. I don't think you can disable it. I was suggesting an alternative that works with SharePoint rather than against it. – RJ Cuthbertson Jan 18 '13 at 18:55
  • Added my solution below. Thanks @rjcup3 for the idea. – iambriansreed Jan 18 '13 at 19:02

Here is what I came up with:

web.AllowUnsafeUpdates = true;
SPFolder rootFolder = web.RootFolder;
rootFolder.WelcomePage = "";
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.


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).

  • Ha. Never tried that in SharePoint designer. – iambriansreed Jan 18 '13 at 20:39
  • Technically the redirect still happens, but it redirects to a page that doesn't exist, thus throwing a 404. – Jesus Shelby Jan 18 '13 at 21:08
  • Yes, which is why I can't accept it. My answer below does disable this redirection. – iambriansreed Jan 18 '13 at 21:45

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.