Choose a hosting. There are several shared hosting, but I know who manages it, so the truth is that I have no problem. Emails, mysql, php, whatever you want, the truth is that I have not found a better one.
Register domain and point it to the new hosting
Once we have clear what hosting we are going to hire, it will give us the dns to be able to point any domain to this hosting. So when we register the domain, here you can use one of the many registrars: 1&1, cdmon, arsys, abansys… we should put the primary and secondary dns to the hosting contracted.
Copy of the old blog
We must make a full copy of the blog as we have it until the time to change it. For this I use filezilla, as 90% of us who move online. It’s like making a backup of the site.
Backup of the database
Here if we need to access the Cpanel of the old hosting. To do this we must do the following:
- Access the phpmyadmin
- Find the database you want to copy
- When you are in that database click on export
- Select custom and choose to zip it
- Download the database and save it in a directory
- Unzip the database and open it with Coda, psPad or notepad
- Search wp_option and replace the domain www.olddimain.com by www.newdomain.com
- Save and compress again in zip
Create new DB in the new hosting
We will enter the new hosting and the first thing is to create a new database. It does not need to be called the same as the one we have copied, or anything, because then we will modify the wp-config.php.
Import the DB
In the new hosting you must enter the DB Management, and then phpmyadmin. Once inside we look for the DB that we have created new and when we are sure that we are inside, if it is new will not appear any table. Then click on import, select the encoding, and the type of compression and click continue. This way all the tables of the old DB have been copied to the new hosting.
It’s time to dump the whole directory of the site that we have copied previously. To do this we configure in Filezilla the new hosting, and upload all the information to the new directory. It will take a few minutes, this is when we can have a coffee.
Update information from wp-config.php
To do this we enter /wp-config.php (I use Coda for this if it is Mac or PsPad if it is PC because you can enter directly through FTP). Once inside the file we modify the values that come from line 23 to 30, putting the name of the new database, the new user name and password. If we use another server other than localhost, we will also have to modify it. Once modified save the information.
Consult phpmyadmin to modify domain
If your blog is on WordPress is a mandatory step. If it is in another support sometimes it is not necessary. Although it is a step that does not involve too much complication. The idea is to change all the data in the DB that refers to the old domain.
To do this we enter the phpmyadmin and enter into the database where we want to change the domain. Once inside, click on sql and in the blank space we put the following:
UPDATE wp_optionsSET option_value = REPLACE(option_value,'old_domain','new_domain');
UPDATE wp_postsSET post_content = REPLACE(post_content,'old_domain','new_domain');
UPDATE wp_postsSET guid = REPLACE(guid,'old_domain','new_domain');
UPDATE wp_postmetaSET meta_value = REPLACE(meta_value,'old_domain','new_domain');
Obviously you should replace old_domain with the old domain you had and new_domain with the current one. In this way all the necessary rows will be changed. It is convenient since there are not many run each of the 4 queries separately but nothing happens if you run them all together.
Modify the general values of the new blog
We should now be able to enter the new blog. But first of all the ideal is to change the initial options: Settings >> General. Here we change the title, description, and especially the address and url. If we have installed the WordPress seo by yoast we should also modify the settings and change all the data from the old domain to the new one. Now you can enjoy your new domain and your new hosting.
Problem with Tintumb.php
My current WordPress theme uses this php script to resize the images, especially on the front page and in the sidelbar on the right. It’s a way to do it, although I know it’s obsolete, but at this point I’m not going to change it. My surprise is that when I enter to the new website (which is the same but with different hosting and domain) I see that it doesn’t show me any of the resized images. My first reaction is to go to the database to check the addresses: everything is ok. I clear cache to regenerate them again, but the problem persists. And when I try to view it with Mozilla firebug, I see that the image is resized with tinthumb.php. It is one of the ways to resize images, which is obsolete, and that can also cause a lack of security on the web, but if you have it updated correctly you should not have problems.
My problem is that it was outdated. So I googled: tinthumb.pha download, copied the latest version [piopialo] and loaded the tinthumb.php file that in my case was in: /web/wp-content/theme/nombredeltheme/tinthumb.php. After refreshing and clearing the browser cache everything worked perfectly.
Now my main concern is not to lose a bit of the positioning I had with my previous domain. That’s why I should make a permanent redirect. How do I do it? Well, in my case I did it using htacces. Executing the following line.
redirectMatch 301 ^(.*)$ https://www.mydomain.com/$1
The problem is that this has to be put on the old hosting. So for a while we can not get rid of this hosting. When we have everything already recognized by google, all changed and with the same results, and then if we can change it, but until then we can not do it because otherwise you will lose all the positioning that had achieved. A piece of advice. If you do not want to lose the information if you update in the old hosting anything or is updated alone,[piopialo] put that line from: # END WordPress this way the htacces will not be modified.
Now I finally have my new hosting and my new domain. Now it only remains to see that everything works correctly and not a single visit is lost.