0

I'm migrating one of my WordPress sites from a development version to the live version. The problem I'm having is with just the homepage links.

  • the homepage link in the masthead is redirecting to the dev version.
  • type the homepage URL into the browser, it redirects to dev.
  • click the 'visit site' link in wp-admin, it redirects to dev.

The reasons might be because the migration didn't replace links in the database tables. And! Just to make it more interesting, my first migration failed. So, for a week I redirected the URL in cPanel to the dev version. I've since deleted this redirection, and every page is OK but home.

For a little context, lets say the live site URL is: http://x.tna.com And the dev site is: http://dev.x.tna.com. That's the same for the server directories: live.x and dev.x. I also used git so I have a repo git.x. There are two databases, tna_x and tna_x_dev.

I've remade the entire migration, including:

  1. (on local using vim) verify all the links in the database (download to local, find and replace all URL subdomain instances of dev. with empty string)
  2. (cPanel/subdomains) Deleted redirection to dev.x.tna.com.
  3. (cPanel/Cache Settings) Disable cache for subdomain x.tna.com.
  4. (WordPress Admin, Settings > General) Verify settings reflect the correct URL.
  5. (SSH) I searched in WordPress files, grep -R dev, and didn't find anything
  6. (phpMyAdmin) I queried the database for dev, and didn't find anything.
  7. (Wordpress Admin, Settings > Permalinks) Chnage permalink settings.
  8. (local browser) delete site cookies

All non-homepage links in x.tna.com are fine. I also have access wp-admin and add content and do other stuff.

Where is this setting hiding?

// Edit. I added #7 & #8; The .htaccess file was unchanged, but I recreated to be sure. And I thought maybe it could be the browser, so I added #8

1 Answer 1

0

You most likely have invalid URLs in the database, however, it's also entirely possible to have a hard-coded URL in somewhere in the theme or perhaps a plugin, or even .htaccess.

You could always search your entire database for the URL, and make adjustments manually. However, please note that if you make any adjustments to a URL within serialization, you should de-serialize it, make your adjustment, then re-serialize it again, before making the update in the database.

If you want a more automated approach to search and replace all occurrences of a string (A/K/A - replacing URLs), you should take a look at WP CLI.

To further troubleshoot...

  • Disable all plugins.
  • Make sure all drop-ins are removed for testing purposes.
  • Verify there's no cache subdirectory in the directory ./wp-content/.
  • Verify contents of .htaccess in the root directory of WordPress.
  • Verify contents of wp-config.php file in the root directory of WordPress.
  • Clear browser temporary files and caches or just try another browser.
3
  • Hmm. I thought #1, #5, and #6 would have covered URLs in the database and plugins. No?
    – xtian
    Aug 20, 2017 at 15:09
  • @xtian Thanks for accepting my solution. Could you please comment with what the problem was? Aug 20, 2017 at 16:17
  • Of course. As I commented in the OP update, I explicitly did #7 and #8 again, but the problem still didn't go away. Nevertheless, Firefox was still displaying the redirection. Then I tried Chrome. Dammit. Firefox is still fracked, but Chrome shows it's only the browser. Thanks for your help. When you cover all the bases, things are supposed to work. I can't imagine what else I need to do to Firefox to get it to behave.
    – xtian
    Aug 20, 2017 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.