Gbp Central For Wordpress Support
Premium wordpress theme

There may instances where you are changing domain name or moving wordpress from a directory to root or vise verse and you have content in database. As wordpress saves full urls in database you will need to change urls so that you do not get 404 error on pages,posts,comments and images.

Very first step is to backup your database so that have saved copy of database on your computer just in case you make mistake and have go back to original install.

Log in on server and go to phpmyadmin and click on export and save all tables as file.

There are three ways you can change urls

Use Notepad++ and open the downloaded file and search and replace the urls and save the file as some other name so that you still have the backup and drop tables in database and import the file with changed urls.

The easy way is to change the urls in database directly and as you have backup you are fine to use this method.

To update WordPress options with the new blog location, use the following SQL command, this will change your urls that are set in Settings >>>General of your wordpress.


UPDATE wp_options SET option_value = replace(option_value, 
'http://www.old-domain.com', 'http://www.new-domain.com') 
WHERE option_name = 'home' OR option_name = 'siteurl';

press Go

To change URLs of the WordPress posts and pages, which are saved in wp_posts table as guid field. The URL are saved as absolute URLs instead of relative URLs, so they need to be changed with the following SQL query:

UPDATE wp_posts SET guid = 
replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

Press Go

If you have links internally within blog posts or pages with absolute URLs, these links need to be changed else they will point to wrong page Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:

UPDATE wp_posts SET post_content = replace(post_content,
 'http://www.old-domain.com', 'http://www.new-domain.com');

Press Go

Browse through WordPress blog to check if everything is okay. You also need to re-login to WP Administration as authentication cookie has now became invalid due to different domain.

Note: You need change prefix if you are using other then wp_
Replace http://www.old-domain.com and http://www.new-domain.com with your urls

You can install this plugin Velvet Blues Update URLs
and follow the instruction form the plugin page.

Once You have made changes you will need to reset permalinks if used.

Govindji Patel
I am Author/Publisher WordPress Coach and Consultant who enjoys writing tutorials and support and help wordpress users build better WordPress website/blog. Read Testimonials
Govindji Patel
Govindji Patel
Govindji Patel

Latest posts by Govindji Patel (see all)

    JVZoo Product Feed

  • FB Member Lock Developer License The FB Member Lock plugin will transform the way you look at Lead Generation by turning any and all content you want into Facebook enabled Membership content on your WordPress Blog. Capture leads to your mailing list in 2 Clicks and add new members to yo
  • WP SHE'S VIRAL - Multi License Unique Content locking WP Plugin, with built in Credit based system and Affiliate links to get you guaranteed Viral Traffic to your blogs.
  • WP SHE'S VIRAL - Developer License Unique Content locking WP Plugin, with built in Credit based system and Affiliate links to get you guaranteed Viral Traffic to your blogs.
  • FB Review Engine Turn every Review on your Blog into a Viral Traffic and SEO Firestorm and build a Buyer List from Confirmed Buyers at the same time! Everyone knows that Reviews and Social Proof are what drive sales these days. Amazon.com is pure proof. Use the power o

Please Leave a Review

Can you please leave Review Select Number of Stars for the review and write review in box and Click on Connect Preferred Button.

Please select Stars and re submit.
Please write a review

Connect with

FacebookTwitterGoogle+LinkedIn
OR

Use your name

Please enter a valid email address.
Please enter your name.