How to move your WordPress website to a new domain

There are several reasons why you might want to move your domain. Maybe you dislike your first choice and want to move to a better one. Maybe you just want to move your website from a subdirectory to a root directory.  Whatever the case may be, you can move your domain quickly and easily.

First, let’s show you how to move your website from a subdirectory to a root directory in your domain.

First, please create a backup of your website. This ensures that there is a new and updated version of your website somewhere. In the case something goes wrong during the moving process, you can always restore your website. You’ll want to back up everything including files, folders, themes, plugins, etc.

If a website exists in the root directory of your URL, please delete it.

Login to the backend of your WordPress website. Go to Settings > Permalinks and switch it to the Default setting. Then, go into Settings > General and change the address of your website. Save your changes.

Use a FTP solution such as Filezilla to login to your website. Download two files from your website to your computer: index.php and .htaccess.

Open file index.php and look for a line that looks like this (you can use the search feature to find it): require ('./wp-blog-header.php). Replace it with this code: require ('./enter_the_name_of_your_subdirectory_here/wp-blog-header.php). You would put whatever the name of your subdirectory is in that space. Save the files, then re-upload them to the root directory of your website.

Log back into your website. Go to settings > permalinks and change your permalinks to the previous setting.

Now when you enter the URL for your website into your browser, it will display WordPress as it is installed in your subdirectory. Voila, you are done!

Let’s move on to how to move your website (and domain) to a new host altogether. This process is a little bit trickier, but you can still do it!

First, it is very important that you backup your website, as explained in the beginning of this article. Backing up a website can be done from your hosting provider’s dashboard or using an FTP client like Filezilla.

Login to your hosting provider’s cPanel and select phpMyAdmin. Select the database for your website and export it. Download it to your own computer.

Now you’ll create a database on a new server. In your cPanel, go to MySQL databases. Create a new database. Create a new MySQL user. Add the user to the database. When you create a database, you are asked to come up with a database name, username and password. Write this down and store it somewhere safe because this is important information you will need in the future.

Your wp-config.php file is an extremely important file that holds all of the confidential information about your website. You need to update this file with the information you just wrote down about your database. Go through your WordPress installation and find the wp-config.php file.

Update the file and find the following:

define('DB_NAME', 'db_name');  

Change ‘db_name’ to the actual name of your database.

define('DB_USER', 'db_user');

Change ‘db_user’ to your username.

define('DB_PASSWORD', 'db_password');

Change ‘db_password’ to your password.

Open phpMySQL and select your new database you created. Select “Import.” It may take awhile to import the database.

Login to your website using Filezilla or another FTP client. Upload your files to the directory.

Configure your website to point your website to the new domain. Login to your hosting provider and change the DNS settings of the new domain to point to your host. It may take a few hours for your host to start pointing your new domain to the host.

It is important to not lose your search engine ranking when you move your website to a new domain. Your search engine ranking is something that you have worked months or even years to build.

You can use the “Change your address” tool in Webmaster tools, which will help notify Google of the URL at the new address. After you have completed the steps above to move your website to the new domain, go into your Google Webmaster Tools account. If you don’t have an account, you will need to sign in and create one, verifying that you are the owner of the website.

Click the gear icon at the top right hand corner of the screen. Select “Change of address.” Fill out the form, including the new domain of your website. Submit the change of address request.

This request will stay active for 180 days, by which time Google spiders will have crawled and indexed your website on their own. This will help redirect traffic to your site and keep SEO.

And that’s all there is to it! We hope you have enjoyed this lesson. Best of luck.

Share:

Post Comment

Tags allowed: <a>,<strong>, <blockquote>.