This is the documentation for concrete5 version 5.6 and earlier. View Current Documentation

There's a number of reasons why a site owner would choose to either enforce a particular url or allow a site to render under a number of different urls.  concrete5 allows a site owner to choose how their site behaves with a few configuration changes.

Let's say your domain name is myconcrete5site.com and your web server is all setup and working at this url: http://myconcrete5site.com

The configuration file that we'll be dealing with is [your web root]/config/site.php and when you open it up with a text editor, it'll look something like this:

define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'myconcrete5site');
define('DB_PASSWORD', 'xxxxx');
define('DB_DATABASE', 'myconcrete5site');
define('PASSWORD_SALT', 'biglongstringoflettersandnumbersxxxxxxxxxxxxxxxxxxx123xxxxxx');

By default (concrete5 version 5.4 and greater) any domain that's your web server is configured to display at this site will just display in the address bar as it was entered into the user's browser.

Enforcing one URL

Lets say you allways want your site to show the full url of: "http://www.myconcrete5site.com" including the "www"

Add these two lines to your config/site.php file (or change the values if they're already there)

define('BASE_URL', 'http://www.myconcrete5site.com');
define('DIR_REL', '');

Once those config values are set, if a user enters "http://myconcrete5site.com" the site will automatically redirect the browser to the value of BASE_URL, in this case:  "http://www.myconcrete5site.com"

REDIRECT_TO_BASE_URL is one other config value that allows additional control but is not necessarily needed.  Setting REDIRECT_TO_BASE_URL  to true will automatically redirect the browser to the url set in BASE_URL (default behavior if the BASE_URL is defined), while setting it to false will render the site at whatever the current url is.

define('REDIRECT_TO_BASE_URL', true); // or false

Some suggestions:

  • If you don't have a BASE_URL set and your site is accessable from multiple domains, your login will be tied to the domain that you login on.  If you login at http://www.myconcrete5site.com and then you go to a secondary domain like: http://www.myotherconcrete5site.com you will have to login again.
  • If your site hasn't launched yet and is at a temporary url, you should probably leave BASE_URL and DIR_REL settings out of the config file or commented out so the site will display at both the temporary url and the permant url while the DNS changes propogate.
  • If you're having trouble with an ssl site redirecting back to the non-ssl url, try setting the REDIRECT_TO_BASE_URL to false
  • If you'd like to do more with multiple urls on your site, you may want to check out the Domain Mapper add-on
Loading Conversation