How I broke WordPress site

How I broke WordPress site

broke wordpress

For the last two months, I was taking a little break with writing a blog. I wanted to finish writing my book and close some other projects. I succeeded. I also have an idea to use this time to work a bit on my blog. I decided to move it to another hosting server. That my adventures begins. I installed it on the new server and migrate all the content. The deciding moment was changing in the domain configuration. The only things that I needed to do are: change DNS addresses and WordPress address in its configuration.

What can goes wrong in this scenario?

I found it out very soon. I made a mistake in WordPress address.

wordpress_address

Then I try to move to some other configuration option and the page fails to load. It appears, that every link on my site direct to nonexistent address.

wordpress_blog_link

“Oh no”, I thought, “all the work for nothing and I have to start from the beginning”. However, after some search, I find out that I can still fix it. Generally, I have 2 options to do it. I also found how I should do this migration to not worry about mistakes.

Edit wp-config.php

These two variables can be defined directly in your wp-config.php file. It contains all local configuration of your WordPress and can have also these variables.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

However, at the beginning, it doesn’t contain these variables defined at all and you have to add them to file.

Edit in database

The other method to fix this problem can be done from the database level.

Table wp-options contains the same configuration variables that can be defined in file wp-config.php. We should change the values of rows with the name: siteurl and home. You can see that is is the same names as for PHP file.

How I should do this

At the end, I discover how we can enable a special mode to migrate your WordPress site. It has a name: relocate mode.

Setting a parameter

define('RELOCATE',true);

into wp-config.php file let us enter the relocate mode. It ensures that siteurl variable won’t be taken into consideration during page generation. Address that led us to the main page will allow us to operate within the administration panel. This option is limited only to the administration panel. The regular blog will not work if we made a mistake, but we will be able to correct it from WordPress configuration.

We should remember to disable this relocate mode after our maintenance work.

That is an easy way to break a blog, stress a bit and finally fix it.

[mc4wp_form id=”510″]

Photo source