I had a requirement to move root level site collection as a subsite, as everyone knows this can be done by using the Granular back up for the site, you need to take .cmp file,
I tried to restore the site to a sub site, i was unable to import it as the site template for the destination site is not matching with the backup file which i took,
i.e. The back up which i took is BLANKINTERNET#0 web template, and i created a blank site wanted to override this site, i.e. STS#1, then again i tried to create a publishing site as the source was the publishing site, again this did not work, becouse destination was CMSINTERENET#1 site,
the best solution is to create site of source site, i wrote a power shell script to achieve this,
1: # Get-SPWebTemplate
2: #$template = Get-SPWebTemplate "blankinternet#0"
3: #New-SPWeb -Url "http://dca-dev-230:6565/sites/guru/gwp/" -Template $templatethis is create a destination site which you want,
then try to import your site, it works well !
after that I had a custom layout which is designed by SPD, as it was a root level collection, something goes wrong no pages which use the custom layout is not working,
because publishing site is not recommended to import and export, Microsoft disables this for publishing site, but still we want to do sometimes.
Steps to work your all layouts pages
1) create a testing page and apply your layout to that page, download this file and check what is the proper name of the <publishinglayout> tag,
this you need to copy and run my below, script.
boring to do for all the pages?
run below script