stsadm, Site Collection Restore, and the “File Not Found” error
Restoring site collections with stsadm is normally a straightforward affair, requiring little to no manual intervention to get things back up and running. That is of course, unless you are restoring sites based on the Publishing Site template.
I recently wanted to take an existing site collection, make a copy of it in the same web application under a newly created managed path and have it reside in a new content database. The backup went smooth, utilizing stsadm -o backup. The creation of the new managed path went off without a hitch. The creation of a new content database and the restoration of the site collection into that database also occurred with no issues.
Browsing the site however told a different story. I was immediately greeted with a standard error page stating “File Not Found”. Browsing to other pages within the site (eg. “/_layouts/settings.aspx“) yielded the same result. After turning on the callstack/debugging and disabling the custom error page, I was greeted with the following:
The problem? Each publishing page points to an incorrect page layout after the restoration. One would think that the restore via stsadm would recognize this and fix it, but it does not.
The fix? The stsadm extensions published by Gary Lapointe. The package built by Gary offers a command call gl-fixpublishingpagespagelayouturl. Verbose? Yes. Does it work? Absolutely.
After running the command and executing an iisreset, the site was once again able to be browsed and appears to be intact.
Reference
- SharePoint Automation: Fix Publising Pages Page Layout URL
- File not found errors when restoring a site collection
- stsadm backup Operation
- stsadm restore Operation
