Giving your existing WordPress MultiSite a new domain name on Microsoft Azure

2 minute read | By Mangesh Sangapu

Prerequisites:

This article assumes you acquired a new domain name and have configured the DNS Zones. If you haven’t already done so, see the article here: Configuring a custom domain name for a Microsoft Azure Web Site

 

Problem:

You installed WordPress through the MS Azure Gallery and setup a MultiSite (WP feature).
However, now that you’re ready for launch, you decide you want to change the name from: http://<sitename>.azurewebsites.net while remaining hosted on Azure.

If you already have your custom domain name pointing to your WP instance and now want to enable MultiSites, then please follow this article here: Convert Azure WordPress MultiSite

If you do not have MultiSites enabled, there are easier solutions you should be following.

 

Make a backup!

[Before we get started, I kindly ask that you make a backup of both your Azure Website. Here is a link that show you how to accomplish this. Azure Web Sites Backup

 


 

Getting Started:

 

Using a MySQL client, connect to your MySQL database.

Verify that WordPress is the only application using the database.

If there are other tables unrelated to WordPress on your database, you’ll have to ensure you do not modify those in anyway.

Step 1. Export your MySQL database

 

Using MySQL Workbench or similar MySQL client, select the Export menu.

 

Select all the WP tables for exporting and be sure to select “Export to Self-Contained File”.

 

 

Step 2. Find / Replace in Notepad

Open the .SQL file in notepad. Do not open this file up in something like MS Word or some fancy editor.
We want a simple editor that will not modify end-of-line characters or anything of that sort.

Do a find->replace of <sitename>.azurewebsites.net to newsite.com. Replace All.

Save this file with a new name (so you don’t overwrite your backup) 

Import your newly modified MySQL Database

 

 

*Step 3. Modify wp-config: Update DOMAIN_CURRENT_SITE*

Use WebMatrix to connect to your site

Edit wp.config

In wp.config change the DOMAIN_CURRENT_SITE to your new site

 

Step 4. Verify your website!

Before you log into your wordpress admin, be sure to clear your cookies.

Go to your website: [http://newsite.com/]{style=”color: #800080;text-decoration: underline”}

Log into WordPress!