Fix URL issues after migration of a website from staging to live server


Fixing URL issues after migration of a website from staging to live server

There are some common issues which arises when we migrate a WordPress website from one server to another, like from staging to live or from one domain to another domain.

Most of the time the main issue comes due to links and url’s which are still pointing to the old staging server. This will give 404 errors for the links and images.

To fix such issues there are many ways in WordPress and we will explain one of them.

This process will require access to your website database. if you have a cpanel hosting then you will find it under phpMyAdmin . If you have any other setup please get the database access to follow this process.

Steps to debug URL issues of WordPress:-

1.  Log into your cPanel interface.

2. Check for database section and select phpMyAdmin tool.

3. It will take you to the main phpMyAdmin page. Check for the database name which is used in your WordPress site.

4. Select the database, then select wp_posts table from the database selected.

5. Now you will find a tab named SQL click on that SQL button and a SQL editor will open below that.

6. Now type these commands and press Go button in the right bottom of this SQL window

UPDATE wp_posts SET post_content=(REPLACE (post_content, 'yourdomain.com','yournewdomain.com'));

and after that run this query –

UPDATE wp_posts SET guid = replace(guid, 'yourdomain.com', 'yournewdomain.com');

Note:- Please note one thing here that there may be different prefix other than ‘ wp_ ‘ for table post, please check if you don’t find the table wp_post.

Example- 01

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.yourOldDomainName.com', 'http://www.yourNewDomainName.com');

UPDATE wp_posts SET guid = replace(guid, 'http://www.yourOldDomainName.com', 'http://www.yourNewDomainName.com');

Great it is done….

7. Check for the links and you will find them all fixed.

So we have fixed all the errors which are coming due to these old url and links.

Happy Coding…

Share on: Share YogiRaj B.Ed Study Notes on twitter Share YogiRaj B.Ed Study Notes on facebook Share YogiRaj B.Ed Study Notes on WhatsApp
Individual counseling
Q. Individual counseling

It is mainly done through interview
It deals with consultation, mutual interchange of ideas, opinion & deliberating together
Used to:- Get information

Read full article
Explain eclectic counselling
Q. Eclectic counselling

It is a combination of Directive and Non-directive counselling.
The counsellor can start with Directive but if and when the situation demands the counsellor may switch over to non-directive counselling and vice-versa.

Read full article
Personal Guidance and counseling
Q. Personal Guidance and counseling

Personal guidance assists the individual to adjust with psychological and social environment. It is to solve the emotional & psychological problems. Educational & vocational guidance also can called personal guidance.

Read full article
Group Guidance and counselling
Q. Group guidance and counselling

Many experiences take place in group settings. Group Guidance is a relationship in which the guidance worker attempts to assist a number of students to attain for themselves satisfactory development or adjustment to their collective or individual life situations.

Read full article

Some important study notes