This page looks best with JavaScript enabled

Fix Wordpress URL Migration Issues

 ·   ·  ☕ 3 min read

Wordpress is fantastic, except when it isn’t.

There are a few scenarios in Wordpress where you would want to migrate from an existing URL (e.g. your localhost, http://domainname.com, or https//abc.com) to a new URL (e.g. https://domainname.com).

You can end up with a confusing setup and a broken site if you don’t go by the book! The easiest way to take precautions for a successful migration is to read a 100 line manual, or may lie in finding a “good plugin” that can migrate the site for you.

But again, who cares. Real humans don’t read manuals. They spend sleepless nights debugging a non-existing problem instead.

Problem

By being here, you have proven fit to be a human - be proud. You probably have also seen one or more of these beautiful errors -

  • Home page in the new URL throws a 500 error
  • The <new-url> will just redirect to the old-url
  • The wp-admin page in the new URL will redirect to old URL
  • <new-url> and/or <new-url>/wp-admin show a blank page
  • It is also most likely that even if you set define('WP_DEBUG', true) in the wp-config file, nothing turns up in the log.

In short: all things that make you fall for Wordpress all over.

There are a million sites that tell you what exactly you need to be doing to resolve the errors. I will just add to the confusion.

Start fixin’

Unfortunately though, I am not an expert. I don’t have “one answer” to all these problems - Wordpress can be complex - at least for me.

Do the following to attempt a fix -

  1. Rename .htaccess in the root folder of your new site to .htaccess1. Try accessing the site again.

  2. Go to PHPMyAdmin > table WP_OPTIONS and change siteurl and home to the new-url. Retry access.

  3. Rename the WP-CONTENT > plugins folder to plugin1 (any name other than its current name will work). Repeat access checks.

  4. Edit the file wp-config.php and add the following lines at the end.

    define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']);
    define('WP_SITEURL', WP_HOME . '/');
    
  5. Clear history, cookies etc. before you retry logging into the <new-url>/wp-admin

Once you get access -

  • first: go to Settings > General, and change Wordpress Address and Site Address URLs. Note that you may be logged out if you change the address (even changing to https from http)

  • next: go to Settings > Permalinks. Change existing value to any new value, and change it back. Or, change to any value that you like.

If none of the steps help, try resetting Wordpress core by keeping rest of the things as-is. You can import a fresh copy of Wordpress by uploading the zip file to your host. The alternative of course is the carpet bomb fix define below.

Final ‘carpet bomb’ fix

The above steps did not help? Well, you need to gulp a pot of coffee, and install fresh version of Wordpress.

Export content, theme, database & everything from the <old-url> using ‘All-in-one WP Migration’. Import the same plugin in the <new-url>, and import the file that you exported previously.

Just remember to login using the old-url id/password in the new URL.

Final final action

Even the final fix did not finally fix things for you? It is time to get started on / practice Vipassana - observe that darn breadth. Take a break from work, meditate, and come back after six months. I can guarantee that it would have either fixed itself, or you don’t view the problem as that which needs fixing.

Stay in touch!
Share on

Prashanth Krishnamurthy
WRITTEN BY
Prashanth Krishnamurthy
Technologist | Creator of Things