After building a site, you need to analyze the performance and speed. The full insight of the site will give you a performance report so that you can monitor it easily.
There may be certain times when you need to migrate your online business in terms of hosting and domain name. There may be a couple of reasons such as:
- At some point, you may realize that the current domain is not the right domain for your website.
- You could be facing some issues with your branding.
- Or you could just want to give yourself a fresh start.
In such situations, most people find it difficult to migrate their website to a new host or using the same host while assigning a new domain name to it. Of course, it is a little bit complex task. Moreover, migrating your domain name could wipe out all the hard work you have done for your site’s SEO.
Most of the independent webmasters or businesses use WordPress nowadays. It’s efficient, easy and powerful as well. So in this article, I will go through step by step tutorial “how you can migrate your domain name easily”.
In the meantime, we have another crucial point to remember that we do not want to lose our search engine rankings + traffic while performing a migration.
So, before proceeding to the tutorial part let me tell you a few things that you should expect and follow during this migration process.
- Do not change your URL structure “permalink” so frequently. Changing your site URL structure will have a bad impact on your SEO since once you change the address people will no longer find the page from a search engine or any backlink.
- You should expect a drop in your current traffic for the first few days or maybe a week. The reason is that all your new posts and pages will be crawled under a separate name which will initially have a low domain authority of course.
- Make sure you do not delete the previous domain and keep the website live on that domain too.
These are some points that you should take care of while migrating your domain name.
Now I am assuming that you have already bought a new domain name and assigned it with hosting nameserver.
From here you will start the process of migration so keep tracking your progress step by step.
#1. Backup Your Website’s Content
Backing up your site contents is very necessary. It will be beneficial for you because while migrating the domain name of your site if anything goes wrong you can immediately fix it by replacing with the backup files.
There are several ways to backup. You can use the hosting default quick site backup option or you can use a WordPress plugin like “all in one migration” or “updraft”.
I prefer to back up the “public_html” folder directly from the host and the database of the website as well. You can apply any method whichever option looks sweet to you. All it matters to have a backup of the site to prevent any data loss during the domain migration process.
* * Depending on the hosting these options may appear different but the work is the same.
#2. Upload the backup contents into your new hosting
Once you have completed the downloading of the backup file, now install WordPress in the new hosting. After installing WordPress open the file manager of new hosting. You can use the default file manager or any FTP client.
Now find the “wp-content” folder from the backup file > extract it and make a separate ZIP file.
Go ahead and upload that zip file into your new site. During the uploading process you will get a notification for replacing the existing contents. Click “replace” and your site content will be uploaded into the new site in a couple of minutes.
In the next step, you will need to upload your previous database into the new one simply by following the “import” technique. Read this guide to know how to do it.
Once your database is updated you can access your WordPress dashboard on the new address once you perform the later part of this tutorial.
#3. Update your site’s new address
Now it’s time to update your website address. First, go to Settings >> General.
Place your new domain URL in both the “WordPress address” and “Site Address”.
** To connect your host with the domain name you should make sure that you have updated the name servers.
Once you have changed the URL in general settings click on “save”, you may be required to wait ⅔ hours so for domain name connection. After ⅔ hours your domain nameserver change will propagate worldwide.
#4. Update the links in the website \
Once you have updated the new domain name in your WordPress, the next step is to update all kinds of internal links that are pointing to the older domain name.
One such plugin is Better Search and Replace. To use this plugin first install it from the WordPress repository.
- Install Better Search and Replace plugin.
- Go to tools > better search and replace settings
- Type your old site URL address in “search for the box”.
- Type your new site URL in the “Replace with” box.
- Select all kinds of tables.
- Check Replace GUIDs
- Check Run as a dry run.
- Run search/replace.
#5. Applying 301 redirects to the links
After updating the internal links of your site, the next step is the most important step in migrating your WordPress website’s domain name. Adding the 301 redirect means directing the traffic from your previous domain name to your new domain name.
** And this is the reason why you should not delete the old website while setting up the new website.
If you skip this step, you will ultimately lose all the backlinks linked with your website. This will obviously put a negative impact on the SEO of your website. Furthermore, if the visitors will click on the previous links on that website, it will drive them to nothing hence eventually generating broken links, generating 404 pages.
You should know that Google takes 404 Errors very seriously. If they encounter too many 404 errors – Google will penalize your rankings.
There are multiple ways to redirect your site links, you can use plugins or do it manually but doing so will be very painful. You can add 301 redirect links by adding them at the server level via htaccess too.
Another great and easy way to add 301 redirect links is with the help of Cloudflare. Follow the step in the image.
Inside Cloudflare, create a “Page Rule” where each URL that matches “yourolddomain.com” is 301-redirected to “yournewdomain.com”.
#6. Update Your Website in Google Webmasters Tools
Once you are done with the redirection it’s time to inform Google that you are migrating to a new website. You can do this using the webmaster tool or currently known as the search console. You will need to send a request to Google regarding the change in the address of your previous domain. This way, Google will recognize that you have migrated to a new domain and will give you some SEO benefits.
** I am assuming your previous site as a verified property of the search console. If you have not verified yet make sure you do it.
First of all, you will need to verify your new website as a property. Once your site is verified go to change of address tool and select your previous website.
Once you have selected, in the next step you will need to pick your new site from the drop-down menu and then scan whether all the 301 redirections are working properly or not.
After that, the tool will confirm both the sites as verified and allow you to submit your new domain as a replacement to the old domain.
While doing so, if you use Google Analytics for tracking your site traffic then you should also create a new property in the analytics tool and connect the new domain with analytics.
#7. Do not forget to submit the sitemap
After submitting your domain change request, you will need to submit your new domain’s sitemap. Once the domain is verified in the webmaster tool you can easily submit your sitemap.
Having a sitemap will provide you additional SEO benefits. You want to keep updating the sitemap of your site too. A sitemap will support your website to get crawled quicker.
After the change of your domain name, it’s time to pay attention to minor details. Update the primary information present in all the plugins associated with your site. And, make sure to track the number of pages with 404 errors and fix them as soon as possible.
Following the above-mentioned steps, you can effortlessly migrate the domain name of your website without hurting the SEO of your site. Although we would recommend not changing the domain name unless it’s utterly essential.
Previously we have published an article about the process of setting up an cookie free domain or cookieless domain, where we have mentioned about creating a static version of your website.
If you have read the article already you must known about what is cookies and how it is useful for storing user informations into the browsers.
However, in the other hand cookies can hinder your webpage performance by not delivering static content to the visitors web browsers.
One example of cookieless domain decreasing page performance: detected by gtmetrix
When a browser makes request for static files on your page such as an image, CSS file etc there is no need for it to add cookies with it, which results in sending additional traffic to the server. And additional traffic means more waiting time for the response by the server.
You can try these steps if you think your server response time is not good.
So the advantage of setup a cookieless domain is that you can separate the content that doesn’t require cookies from the content that requires it.
Using cookieless domain will deduct unnecessary network traffic and eventually increase the server response time + the page performance.
How to setup a cookieless domain for WordPress site
There are couple of ways to set up a cookieless domain. You can read all the procedures in this page. However, in this article, I will mention how to set it up manually for WordPress website.
Before starting the process one thing you need to remember that if you set cookies on the top level domain ( yourdomain.com) all the subdomains will also include the cookies in them. Because, as it sets on the primary domain its childs are going to have the DNA for sure.
So in this case, you are recommended to use a separate domain to deliver static content. It’s a better idea if you register a new domain and configure the web server to serve static resources from the new address. You will completely prevent any cookies to be set in the new domain.
Instead, you can also set two different domains. One which includes cookies and one which doesn’t set cookies. In such a case, will set cookies on a www subdomain (www.yourdomain.com) and separately host your static files from another subdomain like (static.yourdomain.com). This static domain will no longer send cookies with your static files of a page.
Read the following procedures to setup a cookieless domain in WordPress.
1. Create a subdomain
Go to your cpanel and create a subdomain like static.yourdomain.com. From this subdomain you will serve or host all the static files.
Go to subdomains > make sure you are on the page ” create subdomain” > place “static” on the subdomain box > let domain box stay in default name > click on create.
2. Point subdomain to wp-content
Now point the newly created subdomain to the “/wp-content” directory of WordPress installation folder.
To do it again go to your subdomains and edit the settings by clicking on the edit icon next to your new static domain.
It will take you to the document root settings where you need to update the root address from “public_html/static” to “public_html/wp-content”.
3. Update your wp-config file
Go to the file manager using cpanel or ftp client and edit the wp-config file. Make sure the following code is available or added inside the file.
- Remember to correct your domain names accordingly.
4. Direct url to new subdomain
Before taking this step make sure you backup your database in awar to any kind of misconfiguration. Better to practice with demo site before applying in live the version. I do not take any responsibility for further loss of data or website down.
Now you need to run sql query on database table. Go to phpmyadmin > select your wp database > go to SQL tab and paste the following code in the command box.
UPDATE wp_posts SET post_content = REPLACE(post_content,’www.yourwebsite.com/wp-content/’,’static.yourwebsite.com/’)
This will make sure all the post urls are directed to the new subdomain.
- Again make sure that you have corrected the domain details inside the code.
Once you setup everything your cookie domain and static domain are ready for action. And the static domain will start delivering static resources without sending unnecessary cookies traffic.
I hope this guide will help you to establish your static site without any additional problems. Make sure you comment down below in case you need any more information.