Procedure & Hacks of WordPress Migration on server

Hello, Friends, I have heard many our new developer complaining about lack of good hacks & solutions they don’t get while facing WordPress migration issue over the (Shared Server, Cloud Server, and AWS).

So we decided to take a step forward towards to provide you the procedure, errors hacks & solutions so you don’t have to go to multiple sites searching for the same thing again and again.

So first we will describe the basic steps which need to be taken to migrate/set up the existing website on the server and then we will talk about the errors you may encounter or have already faced.

General Guide for WordPress Migration no matter what server you use

Step 1: Upload Files: The most basic step is to zip your files and upload it to your server or you can upload it directly via FTP.

Step 2: Create Database: Create a Database for the WordPress site where you want to import the data of your website.

Step 3: Export database from the old location and import over the server: Now you need to export the .sql file from your old database and import the same into the new database you created on the server’s database.

Step 4: Set up the connection: Since old files were on different Server/Localhost so you need to set up the connection for the files uploaded. Enter the host, username, password and database name at specified locations.

Now here comes the step which many of developers are not aware of you need to change all the old URL to the new ones. We can do this by using a simple plug-in name Search Replace Database .

Step 5: Download the Search Replace Database plug-in and upload to the root of the server.

Step 6: Now just extract the files rename the folder to “srdb” or anything of your choice and enter your URL followed by srdb or whatever name you have given to folder. A screen will open like the image specified below.

 

Step 7: Paste the URL you want to change along with new URL: Just simply paste the old URL in replace field and new URL in the replace with field.

For example, your local URL is http://localhost/phphurdles and domain to which you are migrating is http://phphurdles.com.

Note*- Do not use trailing slashes at the end for both the fields http://localhost/phphurdles is allowed but http://localhost/phphurdles/ is not allowed

Step 8: Dry Run : Now we will go for the DRY RUN. Remember DRY Run is just a trial it will show you the changes which need to be made but it will not change anything in the database.

Step 9: Live Run: After Analyzing the dry run you are all set to make changes to your database. Just click live run and follow the log of changes it does to your website database.

Now refresh your website you are all set to go but wait there is still some twist in the tale.

General Problems Developer faces after setting up the site on the server.

  1. 404 Error on internal pages: It’s the most basic error which is often caused after migrating the site.

Hack: Just log in to your WordPress Panel and go to setting and click on permalink a permalink page will appear just click on any radio button other than selected one and select the original one again and save the permalink.

Now if your .htaccess file is writable to the server it will update it and you will receive success message but if your file is not readable then it will give you some small code which you need to paste over your .htaccess file. Now refresh the website and see all your internal links are working.

 

    2. Unable to login to your admin panel in spite of having write password: This situation occurs very rarely but it needs to be encountered by us.

Either you can generate a forget password request to get the link to set up the new password.

you can create a md5 string and paste it in wp_users table replacing the previous value. For example, I want to set new pass Saurabh just encapsulate Saurabh in md5() just like below

1
2
3
4
5
6
7
<?php

$a=md5(‘Saurabh’);

echo $a;

?>

Just copy the generated code and paste it into the password field of table wp_users. and log in with the new password you will be able to log in.

 

3. 404 Error even doing permalink settings (generally on cloud servers) :

If after doing the permalink settings your WordPress internal pages are showing 404 error then strictly the main cause is “ Your server is not reading .htaccess file”. In many Cloud hosting these services are not auto installed especially in AWS you need to edit apache.conf / httpd.conf (Which ever available) and change AllowOverride None to  AllowOverride None.

Do the above only when you have any previous knowledge of creating virtual host else ask your administrator for support.

 

4. Server asking to reinstall the WordPress site:  Sometimes after migrating your site WordPress asks you to again reinstall the site when you try to access the site. This issue is caused due to the database.

There are 2 main reasons either database has not been fully imported or the prefix used for the tables are case sensitive.

Wp_ and wp_ are different.

So, Mates, hope we could help you to some extent to rectify and tackle the WordPress issues by means of this tutorial. Though there is a long list of errors developers face but the one stated above are the most generic and hard to find.

We love helping our Young Energetic Developers.

Because we believe hurdles aren’t really hurdles.

Cheers!

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *