• Skip to primary navigation
  • Skip to footer navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

WP Fangirl

WordPress Consultant Sallie Goetsch

  • speakerdeck icon
  • Home
  • About
  • Why WordPress?
  • How I Work
  • Portfolio
  • Services
  • Blog
  • Contact

PreviewDNS Can Bork Your WordPress Install—But There’s a Fix

February 26, 2010 by Sallie Goetsch 3 Comments

find replace SQL query in phpMyAdmin

A couple of weeks ago a client decided to move her website and blog from Earthlink, and there was much rejoicing. Earthlink is a terrible place to have a WordPress install. You have to do manual upgrades.

The new host, GoDaddy (not my first choice for hosting, in all honesty, though I have some of my own sites there; their servers are slow as treacle), offers a service called Preview DNS so you can make sure everything works on your new site before actually transferring the domain. This is a handy thing to be able to do and a nice thing for them to offer.

There’s only one problem, as I learned to my detriment. If you install WordPress under Preview DNS, the database is going to be really confused and totally bork your blog when you transfer the domain, because WordPress will be looking for http://www.mydomain.com.previewdns.com when it should be looking for http://www.mydomain.com. This means it won’t call your stylesheet properly and you can’t log in. Eeek!

The nice young man I talked to at GoDaddy hadn’t seen the problem before either, but some of the the other tech support staff there had. In fact, they’d actually put together a help file explaining how to solve the problem of unintentionally changing your WordPress URL.

Fixing it involves editing the MySQL database where WordPress stores all its information. It’s been a long time since I’ve done anything with a MySQL database besides back it up or restore it, but if you follow the directions exactly, you’ll be okay.

First you have to log into PHP MyAdmin. If you’ve forgotten the username and password for this, don’t worry. They’re contained in your wp-config.php file, and you can get to that through FTP. (Or I could, because I set the FTP up with the numerical IP address, not the previewdns.com address.)

Once inside phpMyAdmin, you’ll see a bunch of stuff that doesn’t mean much to you (if you’re like me and stay out of SQL databases). What you need is in the upper left-hand corner.

phpMyAdmin

Click the white button that says SQL (the other one is for the help file) and enter the following code into the box that pops up, replacing the URLs as appropriate.

UPDATE wp_options
SET option_value = 'http://www.newlocation.com'
WHERE option_value = 'http://www.oldlocation.com'

Hit the “GO” button and you should be all set, at least in terms of things like being able to log in, and WordPress finding the theme’s stylesheet.

As it happened, however, there were a few internal links to other posts and other references to the dread “previewdns.com” link. So I needed to figure out how to fix those. This time, it was Lorelle Van Fossen who came to my rescue, with her “Search and Replace in WordPress MySQL Database” article from 2005. With Lorelle’s help, I was able to replace those lingering links in the body of the posts.

Now that I know this, I’ll be less hesitant to venture into my WordPress databases again if I need to—but honestly, I prefer not to need to. I’m sure this isn’t the last site relocation I’ll ever work on, though, so I’ll probably encounter Preview DNS again.

Related Items

  • backup in progress
    WordPress Database Backup
  • Database check and repair tools in cPanel
    Checking and Repairing Your WordPress Database
  • How to Repair and Optimize Your Database in WordPress 2.9

Share this post:

Share on Twitter Share on Facebook Share on Pinterest Share on LinkedIn Share on Email

Filed Under: Hosting and Servers Tagged With: Site Migration

Reader Interactions

Comments

  1. Dale says

    January 31, 2011 at 8:21 pm

    Awesome! This, together with the Lorelle Van Fossen article saved me and my associates many hours of re-work changing the URLs of hundreds of images uploaded when our site was under GoDaddy’s preveiwdns system. GoDaddy should warn people about that!

    Many thanks!

    Reply
  2. Justin says

    September 4, 2011 at 6:58 pm

    Brilliant! Thanks for putting this together in one easy to use place. I’m moving back to maddogdomains (godaddy reseller) after a very short stint on ipage. I personally never had the slow issues with godaddy that you did, but ipage….thats a different story.

    I really appreciate the easy to follow instructions. This will hopefully save me some serious time!

    Reply
  3. Kevin says

    March 31, 2017 at 8:08 am

    I know this is a very old blog post, but I saw it and thought I might leave a comment anyway, in case anyone searching in the future ends up here.

    Lorelle Van Fossen notes in that blog post:

    “Again, I never do this without a backup, and even I have screwed this up, so if I can do it, I’m sure you will, too.”

    One way her method can cause problems is if a serialized string is modified. My oversimplified explanation: Basically, there may be indicators in the database about how many characters some strings contain. So if you are ever migrating a site, let’s say for example, http://dev.mysite.com, the string “http://dev.mysite.com” contains 21 characters.

    If you do a standard search and replace, but you replace “dev.mysite.com” with “mysite.com,” the string noted above will only 17 characters, but if that string is serialized anywhere in the database, then the database will still expect a 21 character string, which can make things act wonky.

    Thankfully there is an awesome plugin that will do the search & replace for you and take care of any serialized strings. I’ve used it many, many times and it’s saved me a lot of aggravation.

    You can find it here: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    Good luck!

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

What I Write About

  • Book Reviews
  • Content Strategy
  • Design
  • Hosting and Servers
  • Most Valuable Plugins
  • There's a Plugin for That
  • Using WordPress
  • Widgets
  • WordPress Consulting
  • WordPress Events

Series

  • Interviews (5)
  • Checking Up on Your Website (4)
  • Client from Hell (5)
  • WordCamps (17)
  • WP-Tonic Roundtable (30)
  • Modern Tribe Tutorials (13)

Follow Sallie on Twitter

    Sorry, no Tweets were found.

RSS Latest News from the East Bay WordPress Meetup

  • Does It Work? Using The New CSS Layout with Rachel Andrew
    Things change rapidly in the WordPress world. The content in this post is more than a year old and may no longer represent best practices.Description Over the past two years, […] The post Does It Work? Using The New CSS Layout with Rachel Andrew appeared first on East Bay WordPress Meetup.
  • Speaker Training
    Get the workbook and slides for the October 2019 speaker training, plus background and pro tips. The post Speaker Training appeared first on East Bay WordPress Meetup.
  • SEO Audit Template & Resources
    Our November speaker, John Locke, graciously provided a template for an SEO audit report. You can download it as a Microsoft Word or PDF document. The post SEO Audit Template & Resources appeared first on East Bay WordPress Meetup.

Footer

Contact Info

2063 Main St #133 · Oakley, CA 94561

+1 (510) 969-9947

author-izer

sallie [at] wpfangirl [dot] com

Location

Map of East Contra Costa County

I live in Oakley, CA and run a WordPress Meetup in Oakland, CA. Don't confuse them!

Subscribe for New Posts

  • Since I blog on an unpredictable schedule, you might want to subscribe by email. I'll also send out occasional announcements about events.

  • Privacy Policy: I will never sell or rent your contact information.

  • This field is for validation purposes and should be left unchanged.
  • Contact
  • Colophon
  • Comment Policy
  • Privacy Policy
  • Five for the Future

Copyright © 2023 · Utility Pro on Genesis Framework · WordPress · Log in

MENU
  • Home
  • About
  • Why WordPress?
  • How I Work
  • Portfolio
  • Services
  • Blog
  • Contact