SharePoint My Site link stops redirecting users to their Personal Site

Hopefully this can save someone some time.  The symptoms are:

  • Clicking the My Site link in a SharePoint site results in an IIS 404 File Not Found error page being returned.  However, you are able to browse directly to the users My Site by browsing http://mysite/personal/user.  [http://mysite is the URL to the web application hosting the Personal Sites]. 
  • Browsing anything in _layouts on this Web Application returns an IIS 404 File Not Found error page.  For example, the following URL would fail:  http://mysite/personal/user/_layouts/settings.aspx.
  • IIS shows the _layouts directory and it is configured the way other working web applications are configured.

After doing some troubleshooting, we found that IIS is not trying to load any files from the Web Application content path.  So the web.config is not even being looked for when browsing _layouts or the root of the My Site.  We were able to find that the site collection in the root of the Web Application was missing.  You can check for a Site Collection at "/" using "stsadm.exe -o enumsites -url http://mysite" or browsing Central Admin | Application Management | Site Collection List.

The root site collection in the My Site Web Application redirects users to their Personal Site.  If the user does not have a My Site, this Site Collection creates one for them.  It also displays the public information about users.   Since this site was missing, SharePoint returns a 404 File Not Found message and no one is redirected to their My Site.

The reason the Site Collection was missing was because an admin tried to delete a user's My Site.  The tricky part in this situation is when a user browses another person's My Site, they get redirected to a page in the root site collection.  Here's the scenario:

  1. You need to delete user bobsmith's My Site and decide to do this by browsing the Site Collection, going into Site Settings and deleting the Site Collection.
  2. Open a browser and enter the URL to the persons My Site: http://mysites/personal/bobsmith . 
  3. Since you are not logged in as bobsmith, you get redirected to http://mysite/person.aspx?accountname...
  4. When you click on Site Actions | Site Settings, you are really doing this on the root Site Collection at "/" and not the one for bobsmith at /personal/bobsmith.  Deleting the Site Collection in this manner, will result in the root Site Collection being deleted.
  5. It is important to note that by default the SharePoint System account is the only account that can perform the delete action.

In order to get the Site Collection back, you need to do the following:

  1. Browse Central Administration | Application Management
  2. Click Create Site Collection
  3. Select the My Site Web Application
  4. Set the Title to My Site
  5. For URL, select the "/" option for the root 
  6. Select the My Site Host site template on the Enterprise tab
  7. Set the SharePoint System account as the owner.
  8. Click OK

 If you need to delete an individual's My Site, you need to use the Delete Site Collection option in Central Admin | Application Management, or the STSAdm.exe command-line (stsadm -o deletesite -url http://mysite/personal/bobsmith).