Site url for testing/live versions
-
I’m trying to implement a solution for making url’s work on both testing server and live.
One method I read about is to make a wp-confing test version and live version, and add this to main wp-config file:
if (file_exists(‘/wp-config-test.php’)) {
include(‘/wp-config-test.php’);
}
elseif (file_exists(‘/wp-config-live.php’)) {
include(‘/wp-config-live.php’);
}Then add:
define(‘WP_HOME’,’https://localhost’);
define(‘WP_SITEURL’,’https://localhost’);to the test config file
and…
define(‘WP_HOME’,’https://mysite.com’);
define(‘WP_SITEURL’,’https://mysite.com’);to the live config file.
I’ve tried this, but since I don’t really know what I’m doing, I wanted to ask here if this is the right approach?
Also, I’m not entirely sure how to implement the url links –
should I enter “WP_SITEURL” in place of the absolute path in my links? So, for example if I wanted to link to a picture in my uploads folder i would put “WP_SITEURL/wp-content/uploads/2022/06/background.jpg” ?
I’ve tried that but it doesn’t work so assume I must be doing something wrong.
- The topic ‘Site url for testing/live versions’ is closed to new replies.