Hosting & Domaining Forum

Hosting & Domaining development => Programming Discussion => Topic started by: BrettUK on Aug 18, 2022, 10:53 AM

Title: Transfer website to another domain
Post by: BrettUK on Aug 18, 2022, 10:53 AM
Hi! Transferred the website (WordPress) to another domain within the same hosting. I seemed to do everything according to the instructions (created a new DB, changed the data to new ones in wp-config, robot.txt and redirected from the old domain to the new one in .htaccess (though then the entered data disappeared somewhere)). But the transfer does not seem to be complete.

The fact is that if I leave the old domain attached to the site, then when you open some page at the old address, it opens. Only when a new page is opened, the website is already opened on a new domain.

And if you detach the old domain, then the website is not redirected from the old to the new address at all, but simply does not open.

Can you please tell me where I messed up?


Another (last) question: should the old domain be detached from the website and leave only the new one, or should both domains be available (attached to the site on the hosting) during the transition?
Title: Re: Transfer website to another domain
Post by: tevez on Aug 18, 2022, 11:05 AM
try like that:

RewriteCond %{HTTP_HOST} ^meggido\.com$ [NC]
RewriteRule ^(.*)$ https://checkingsites.com/$1 [R=301,L]

And add above #BEGIN Wordpress code like this:

<IfModule mod_rewrite.c>
Rewrite Engine on
RewriteBase /

RewriteCond %{HTTP_HOST} ^meggido\.com$ [NC]
RewriteRule ^(.*)$ https://checkingsites.com/$1 [R=301,L]
</IfModule>


Between #BEGIN and #END it is better not to write anything, as I said, it will be erased somehow, just click "Save" in the "Settings".
Title: Re: Transfer website to another domain
Post by: EJASNathan on Oct 24, 2022, 12:22 PM
Each web hosting may have a different domain change process, but everyone must have their own instructions for this case. So, we find it on the official website of your hosting provider and follow it clearly.
Difficulties may arise if, together with the domain, you decide to change the server, CMS, design or structure of the site. It will not be possible to describe all the cases in one article, so now we will focus only on changing the hosting.
To do this, you will need, in addition to files, to copy and move the database. Where exactly, again, should be in the provider's instructions. But please note that now many of them provide a free (or almost free, for a nominal amount) service for transferring your resource to their hosting. This greatly simplifies the task.

Traffic redirection
Well, you have already moved the site. But now you need to set up redirects from the old domain to the new one.
To do this, we set 301 redirects to all URLs. In this case, search engines will understand that your site has moved to a new domain and automatically redirect visitors to it. That is, when a person enters an old domain in the search, he will automatically get to the new one.

Note that 301 redirects need to be installed for absolutely all URLs, from all pages, for links with and without "www.", as well as for http and https protocols. Also in the file robots.txt you will need to change the hostname:
User-Agent: *Disallow:Host: newdomain.name

Setting up search engines
The next step is to change the domain name in the search engine settings. Let's look at the example of Google. To do this, go to Google.Webmaster – Section "Indexing settings" - Moving the site – Enter a new domain name – click save.
But that's not all. Each search engine also has its own procedure for moving the site, and everyone has their own instructions. We advise you to familiarize yourself with them.

The procedure for moving a site in Google
For example, it may matter which protocol you use (http or https) or whether the domain has the prefix "www". It also describes cases of a possible decrease in SEO indicators, their causes and tips for promotion.
By the way, I recommend not to rush to delete your old site, but to use it as a mirror. This will guarantee to save more traffic.