In this article I would like to explain a problem I faced after import & the solution.
I was converting a site to site collection using PowerShell commands.
The source site was: http://server/site
The destination site collection was: http://server/newsite
Please note that the URLs are same in this case.
After the import, one of the sub sites having Publishing Pages inside it throws Layout Error as shown:
Error Message: This page is not using a valid page layout. To correct the problem, edit page settings and select a valid page layout.
This is a bug within Exported Sites where the parent site layout master-page url is hard-coded inside the publishing page. There is no way to change it through SharePoint user interface.
You can try one of the following solutions:
1. Use the PowerShell in following link to update the page with correct master page URL link
2. Use the C# code in following link to update the page with correct master page URL link
3. Modify the page manually
Modify the Page Manually
In my case the first 2 options did not worked, then I downloaded the file, modified it, uploaded back & the problem was resolved.
Please follow the following steps:
Step 1: Download File
Open the Pages library of the affected page. You can use direct URL as given below:
In the appearing page choose the Pages library and download the Default.aspx page. (Choose item context menu, Send To > Download a Copy button)
Step 2: Modify File
Open the ASPX file & locate the section <mso:PublishingPageLayout>. A sample text is given below:
<mso:PublishingPageLayout msdt:dt="string">/_catalogs/masterpage/WelcomeLinks.aspx, Welcome Links</mso:PublishingPageLayout>
Please note that the link is pointing to the root site, in my case it should point to the new site collection. So I will change the URL: /_catalogs/masterpage/WelcomeLinks.aspx
To new URL: /newsite/_catalogs/masterpage/WelcomeLinks.aspx
Step 3: Upload File
Now upload the file back to the same library & overwrite existing one. Make sure you check in the changes.
Step 4: Retest Page
Now go back to the browser, clear the cache & retry the problem sub site. This time you should see the Page is working correctly.
You need to ensure that the Publishing feature is enabled in the newly created site collection & site. Additionally make sure the master pages are valid. You can see master pages through url _catalogs/masterpage.
In this article we have explored a possible After-Import problem & the Solutions.v