Saturday, February 19, 2011

404 Page Not Found Error After Migrating from MOSS 2007 to SharePoint 2010

After migrating from MOSS 2007 to SharePoint 2010, All the Sub-sites scolded me with: 404 Page Not Found error! But still able to get into the inner pages/document/site settings.

Common causes for HTTP 404 Not Found issue: 

  • Verify the Host header in IIS and make sure its valid.
  • Managed Path which were present in old environment may not be there in New Environment.
  • Alternate access mapping - Make sure you have the Alternate access mapping set correctly and you are accessing using the right alternate access mapping, access your site with FQDN. If you are accessing the site using IP address, then update your DNS Entry/HOST file
But in this case, all above things were set to right. Looked at the event viewer, Logs files but could not figure out the cause of this problem.
sharepoint 2010 migration 404 error

Verified Welcome page settings, Confirmed that the Default.aspx exists in the site by Opening site in  SharePoint Designer. sharepoint 2010 migration 404
After scratching the head and with little trial and error figured out the solution: Check-out "Default.aspx" file and check-in back!!!

Wrote a Powershell script to do Check-out and Check-in. In my case, I wanted to apply this fix for all sub-sites, So the code goes like:
$SPsite = Get-SPSite <SITE-COLLECTION-URL>
foreach ($SPweb in $SPsite.AllWebs) 

{
   $SPFile = $SPWeb.GetFile("default.aspx");
    $SPFile.CheckOut("Online",$null);
    $SPFile.CheckIn(1);
    $SPweb.Dispose()
}
$SPsite.Dispose()

Another nifty Check-out, Check-in scripts:
http://sharepointandpowershell.com/wp-content/uploads/Invoke-SPFileCheckin.txt
http://sharepointandpowershell.com/wp-content/uploads/Invoke-SPFileCheckout.txt



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Five Challenges in SharePoint Security
...And How to Solve Them. Free White Paper
*Sponsored


Check out these SharePoint products:

4 comments :

  1. Thanks for this, it is helping. However, is there a way for the Invoke-SPFileCheckin.txt to recurse the folders within the document library? We have serveral libraries with subfolders within subfolders and recursing would help a lot. Thanks.

    ReplyDelete
  2. Hi Salaudeen

    Thanks for this. It has worked well for me on a number of occasions - except for one.

    In this particular migration, the checkout call fails with the error "the file xxxx/default.aspx is checked out for editing by dom\SPFarmSetup".

    SPFarmSetup is the account I am logged in with and is the account used to setup the SharePoint farm. Needless to say it has full rights across the web applicatoin and is a farm admin.

    I have tried doing it via SharePoint Designer as well, but there I get a similarly obtuse error message. If I try to check it in, I get "Cannot perform this operation. The file is no longer checked out or has been deleted."

    I am given the option of Undoing the Checkout, which appears to work, though still elaving me woth the 404 error. If I then try to check it out and in again I get the same error.

    Are you aware of any way I can get around this - or to force the check in/out process?

    ReplyDelete
    Replies
    1. Hi Andrew,

      This could be caused by various reasons. Try these things and revert to me back if any of the below works for you..

      * Edit the properties of the page/file and Make sure your file has all the mandatory fields values supplied.

      * If your page is based on content type: Go to site actions > Site settings > Site Content Type > and Pick the content type of your page , set the fields (such as "Title") to "Optional"

      * This Could be of alternate access mapping issue - Make sure you have the Alternate access mapping set correctly and you are accessing using the right alternate acccess mapping (Dont open the site using "localhost:port" or "hostname" instead of full host name like "Company.HostName") access your site with FQDN. If you are accessing the site using IP address, then update your HOST file

      * clear your cache - Delete everything under these folders:
      c:\Users\YOUR-USER-NAME\Local Settings\Application Data\Microsoft\WebsiteCache
      C:\Users\YOUR-USER-NAME\AppData\Roaming\Microsoft\Web Server Extensions\Cache

      * Check if you have any event handler, try disabling them.

      * Check whether the Master page/Page layout associated with your particular page is checked out. If so check them in back.

      Check this KEDB: http://support.microsoft.com/kb/2273439

      Try check-in from Browser rather SPD.

      Delete
  3. I get 404 Error for all the subsites when i use different alias name

    Example : migrated the SP 2007 to 2010
    with a hostname http://intranet

    added the new hostname {IntranetUpgraded} to IIS and tried browsing with the new hostname.

    the root pages come up
    http://IntranetUpgraded

    but subsites
    http://IntranetUpgraded/sites/subintranet
    throws 404 but

    when i replaced the hostname with http://intranet/sites/subintranet it works


    any advise would be appreciated

    ReplyDelete

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...