Change site url in 5.5.1

Permalink 2 users found helpful
Did this process change for 5.5.1? I don't see the

define('BASE_URL', 'http://site.com');


in the /config/site.php file.

View Replies:
dancer replied on at Permalink Reply
dancer
Hi there,
I was wondering the same thing and came across your post.

I have moved my website from:
test.mydomain.com tohttp://www.mydomain.com

Now the CSS won't load, I am assuming it's because of the change in URL but I can't find the "define ('BASE_URL'....), in the site.php. Why is this? I assume I can just add it?

Thanks
gdecris replied on at Permalink Reply
gdecris
I have the same issue? Has anyone found a resolution.

I tried adding the define('BASE_URL', ....) but to no avail.
I also checked the 'Config' table and I do not see an option for it there.

Where could it be hiding :)

Thanks in advance
ScottC replied on at Permalink Reply
ScottC
It is actually inferred from the $_SERVER array

It has actually been optional for quite a while, my part-time employer has been leaving it out for quite a while, they are running mostly 5.4.2.1

To answer your question about where these are defined, when concrete5 is ran it invokes concrete/dispatcher.php through a require statement in your index.php file.

So in there it loads up a file located at concrete/config/base.php and the actual code is
# These items should be set by site.php in config/ but if they're not that means we're installing and we need something there
/* https patch applied here */
if (!defined('BASE_URL')) { 
   if(isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) {
      define('BASE_URL', 'https://' . $_SERVER['HTTP_HOST']);
   } else {
      define('BASE_URL', 'http://' . $_SERVER['HTTP_HOST']);
   }
}
if (!defined('DIR_REL')) {
   $uri = substr($_SERVER['SCRIPT_NAME'], 0, stripos($_SERVER['SCRIPT_NAME'], DISPATCHER_FILENAME) - 1);
   define('DIR_REL', $uri);
}



I guess the thinking is that if it is good enough to get an install to load then it might as well not be there. Less code is better code :)
jasteele12 replied on at Permalink Reply
jasteele12
Hmm, I would say in the case of c5 "less executed code is better code" :)