Moving a Sub-Site
At work the other day, I was asked to move 3 sub-sites from one site to another.
I’ve never done this before, so a colleague gave me guidance with the following steps:
‘Site Actions’–>’Manage Content and Structure’–>(Click on the site where sub-site exist)–>(on the right side, check sub-site(s) you want to move)–>’Actions’—>’Move’
The moving of the sub-sites worked like a charm but there was one tiny problem. When the users would navigate to the old sub-site, it did not redirect them to the new one. In fact, the old site did not exist anymore because it was moved.
So, how do I solve this issue?? Now the following is not a perfect solution, I don’t even know if it’s good practice but here’s what I did (And I only did it this way because there were only 3 sub-sites to move. If there were a lot more, I would have looked for another solution). I followed my colleague’s steps above and when I got to ‘Actions’, I selected ‘Copy’ instead of ‘Move’.
var pathName = window.location.pathname; //pathName value: https://myServerDomain/mySite/oldsubsite/Default.aspx
var newPathName = pathName.replace(“oldsubsite”, “newsubsite”);
alert(“Please take note of the new location. You are now under knowledge Management structure.”);
window.location.replace(newPathName); //newPathName value: https://myServerDomain/mySite/newsubsite/Default.aspx
That was quick and dirty but it worked for what I needed.
Leave a Reply