I am really difficulties in using relative root url. I installed my wordpress site /root/mywordpress/tester1 folder and when I installed my wordpress sites with my subdomain like http://mywordpress.mydomain.com/tester1. It doesn't work and all images are broken.
Here is my use in wp-config.php file
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'].'/tester1/');
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'].'/tester1/');
define('WP_CONTENT_URL', 'tester1/wp-content');
define('DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST'] .'/tester1/');
Is there better solutions for using relative root url for installing wordpress in folder of subdomain
$_SERVER
is not really reliable for various reasons. One is, that every internal connection or every command line call won't have the data available. And that's probably the problem you're facing. What's your exact use case? Please file an edit and explain it.