Moving local wordpress page to a real server subdomain broke my permalinks?

I developed a site locally with /%postname%/ permalink structure. I did some sample posts locally and wanted to move this entire local setup to a temporary subdomain like http://review.clientsite.com.

1.) I exported the local sql table and imported it on the real database

Read More

2.) I changed the two fields inside the wp-options table to fit the new url http://review.clientside.com

3.) I uploaded all files to the real server and got rid of the “wp-config.php” and installed wordpress on the real server.

4.) If I launch http://review.clientside.com I see the site running and everything seems to work just fine. The stylesheets, the js, everything.

However only thing that does not work are my permalinks! Every link ends in a 404 -> e.g. http://review.clientside.com/projects

I also copied the .htaccess file from my local server to the real one.
I even tried dropping the entire “permalinks” field in the wp-options table and reset the permalink-structure in the permalink settings inside wp.

Any ideas on that matter?

Related posts

Leave a Reply

2 comments

  1. You have to change other URLs in the database, not just in the wp_options tables. Use these queries in phpmyadmin to change post links and metadata within post and page content:

    UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com/','http://www.newdomain.com/');
    
    UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain.com/', 'http://www.newdomain.com/');
    
    UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.olddomain.com/', 'http://www.newdomain.com/');
    

    Reset permalinks again after those changes. And also use the full search in phpmyadmin to check if your old domain is anywhere else, such as in widget or plugin data.

  2. My checklist for such cases is as follow:

    1. .htaccess, did I plug it in the prod website?
    2. Did I scrub the database properly?
    3. As a last resort, can I modify it in wp-config.php?

      1. — htaccess —
        One thing that is important to consider is the existance of a .htaccess file.
        It seems to be the most common issue.

      2. — DB Scrub —
        When migrating data local->development->staging, I personally use the following tool to “scrub” the database.
        Interconnect/IT (https://interconnectit.com/products/search-and-replace-for-wordpress-databases/) — Not paid, just awesome for DB scrubbing.

      3. wp-config.php — Alternatively, you can do the following in your wp-config.php file:

    !defined('WP_SITEURL') && define('WP_SITEURL', 'http://review.clientside.com');
    !defined('WP_HOME') && define('WP_HOME', "http://review.clientside.com");
    

    In all cases, make sure to reset permalinks from WP admin, after you complete the setup.