The WordPress content management system is very tightly bound to the site's domain, for this reason it is not so easy to simply run a copy of the site on another hosting or [test domain] , because first of all you need to change the site's domain in the site's admin panel or directly in the database .
But there is a life hack for this case - the configuration file wp-config.php
provides for the use of variables for use as a site domain.
1. So, let's go to the [file manager] of the desired site and open the wp-config.php
file for editing.
2. Immediately after opening the php
tag, add the following code:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']); define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
3. The finished version should look like this:
4. We save the changes in the file, and from this moment the site should open both on the test domain and in the case of changing its domain.
All question categories