Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Site url for testing/live versions

$
0
0

Replies: 0

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’,’http://localhost’);
define(‘WP_SITEURL’,’http://localhost’);

to the test config file

and…

define(‘WP_HOME’,’http://mysite.com’);
define(‘WP_SITEURL’,’http://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.


Viewing all articles
Browse latest Browse all 59525

Trending Articles