0

I have a web application with url: http://hydsp:2020. I would like to change the url to http://hydsp:2020/sites/myhome

The web application should accessible with only second url but not first. I am using SharePoint 2013 on premises.

Please suggest me the solution.

0
  • Backup your site collection from http://hydsp:2020.
Backup-SPSite http://hydsp:2020 -Path C:\Backup\site_name.bak
  • Create a new site myhome at the same web application to be under sites

  • Restore it to myhome site site

Restore-SPSite http://hydsp:2020/sites/myhome -Path C:\Backup\site_name.bak

To let only the site accessible from only the new URL,

  • you can't stop this web application because of your subsite myhome at the same web application.

  • So you can add redirect web part if someone tries to access the old URL go directly to the new URL

    • At the home page of http://hydsp:2020/ add Script editor to redirect directly to http://hydsp:2020/sites/myhome
<script>
$(document).ready(function() {
window.location.href = "http://hydsp:2020/sites/myhome"; //redirect
}
</script>

Note : Don't Remove-SPSite at http://hydsp:2020 because it's the site collection that will hold your subsite http://hydsp:2020/sites/myhome

See also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.