After WordPress database import – “This webpage is not available”

I’m working on a WordPress project and I have my WordPress folder inside a git repo, so the files are identical on my PC and laptop.

I tried to export the “wordpress” database from my PC and on my laptop dropped all tables from the “wordpress” database and imported the .SQL. So that should mean the databases are identical as well.

Read More

But now I’m getting “This webpage is not available” (Error code: ERR_CONNECTION_REFUSED) in Chrome.

Any ideas?

Related posts

Leave a Reply

2 comments

  1. Yes, the databases are identical, which is likely the problem WordPress keeps a lot of URLs in the database, including the main URL for the site.

    Your site is probably trying to redirect to an address of localhost or similar on your PC, which, of course, it can’t.

    If you are going to do this with a WordPress database, you need to change at least the URLs in the wp_options table. You can edit the database with something like PHPMyAdmin.

    That will probably get your site running, but all of the images will point to the old URLs and so forth. To cover everything, I sometimes use a quick approach like:

    UPDATE wp_options SET option_value = REPLACE(option_value, 'oldURL', 'newURL') WHERE LOCATE('oldURL', option_value) > 0;
    UPDATE wp_posts SET guid = REPLACE(guid, 'oldURL', 'newURL') WHERE LOCATE('oldURL', guid) > 0;
    UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'oldURL', 'newURL') WHERE LOCATE('oldURL', meta_value) > 0;
    UPDATE wp_posts SET post_content = REPLACE(post_content, 'oldURL', 'newURL') WHERE LOCATE('oldURL', post_content) > 0;
    

    The only issue is that not everything gets properly converted. WordPress uses quite a few serialized strings in the options table (e.g for widgets), so when you just replace part of them the lengths are wrong the the serialized string no longer works.

  2. Based on my experience, I always use the following plugin:
    WP Migrate DB

    It’s very simple to use and you’ll be able to export your database without having to manipulate anything. The plugin automatically updates the URLs depending on the parameters you define before starting the export process.

    I really appreciate this tool and use it for every migration/deployment, you should give it a try. It’s completely free and after a lot of migrations I never had any problems.

    Let me know if it helps you.