Sometimes in development environment and even in production you may need to rename a site url. For example you have planned a site with URL www.mysite.com in Development or in Production. Later you have decided to rename the site url to www.yoursite.com. There’s no shortcut way to do that in SharePoint. You need to delete the existing web application for url www.mysite.com and create a new one with url www.yoursite.com.
1. Backup the site collection first
Run the following powershell command to backup site.
Backup-SPSite –Identity SiteUrl –Path BackupLocation
2. Delete the existing site from central admin.
Navigate to central admin and delete the web application including database and IIS site as shown below:
3. Create the a new site with new Url (say http://www.yoursite.com)
Now create a new web application with the new url in host header as shown below:
4. Restore the backup on the new site
Finally restore the backup taken on step 1 overwriting the new site collection. Run the following command on powershell command
Restore-SPSite –Identity SiteUrl –Path BackupFilePath -Force