Make the site launch process easier by using either the site_url or homepage variables in configuring Control Panel paths.
I think the site_url and homepage variables are a couple of my favorites in ExpressionEngine. I’ve found that you can actually use these in the EE Control Panel - wherever paths need to be specified. This includes:
- Weblog Path Settings
- File Upload Preferences
- Category Image URLs
Why would you want to use variables in these spots?
What happens to me quite often is - no matter how hard to I try to remember - I forget to change these paths after a site goes live. Then when, for example, someone uses the Search, the path of the link returned still has the “temporary” domain name in it. The link will still work, but it messes up your server logs and just doesn’t look as nice as getting the live URL in there. Or - I decide to rename “index.php” to something more semantic and then have to go find all the places where “index.php” is stored.
So - what I discovered I could do is use the variables in those settings - and then they will inherit the change to the homepage and root URL setting automatically.
So, for example, rather than having a Search Results URL setting of :
http://some.domain.here/index.php/template_group/template/
I can specify:
{homepage}/template_group/template/
Now when I change the “URL to the root directory of your site” and the “Name of your site’s index page” under Admin > System Preferences > General Configuration all those individual weblog paths will change as well.
With some paths -like category images - you won’t want the “index.php” in there since you are referring to an image and not a template. In that case you can use site_url instead:
{site_url}images/uploads/category_accessories_150.jpg
Variables in Control Panel path settings == one less thing to worry about when launching a site == well worth it.
Series Navigation
Next entry: Integrating Monoslideshow with ExpressionEngine
Previous entry: Member Photo Gallery in ExpressionEngine
Previous Comments
I really enjoy almost of {site_url}
{site_url} & {homepage} work well within the template engine but with some plugins while using MultiSite Manager these often give wrong results.
When setting up as secondary site, your great business site tutorial. “Image Sizer” plugin needed the image path defined as…
/images/uploads/image_file.jpg
{site_url} failed to display.
Using TinyMCE plugin with images, {site_url} get’s even stranger. I use…
http://example.com/images/uploads/image_file.jpg
(btw) the above mentioned tutorial… services/detail template appears broken on your demo site
Thanks again for these tutorials
Hi Peccavio -
Thanks for the comment and the input. Good point on the plugins and MSM—that’s a layer of complexity many of the third party developers overlook when creating plugins, IMHO. Good to be on the lookout for it.
On the broken template - do you mean the demo site here or on Boyink.com? I’m in the process of bringing those tutorials over to train-ee and simplifying the backend required in the process. If you have a link I’d greatly appreciate it.
Mike,
I guess its a good thing I am coming to the training because i can’t seem to figure out how to implement your suggestion above. I put {site_URL} in the control panel under general configuration and it brought down the site :>.
Can you be more explicit or am I just missing the obvious? I think i just dont get how to use the variables in the context syntactically.
Ah - that’s where the *value* of the variable needs to be entered.
In other words the site_url variable will always return what you’ve specified under General Configuration. Put the URL there, and use site_url in the other places I mentioned.
Add Your Comment
Latest Products
- Screencasts : Prepping an EE Site for Client Access
So you’ve been slaving away… More >> - Screencasts : Members-Only Content and Workflow
Do you have content that… More >> - Screencasts : Designing an ExpressionEngine Architecture
OK - so you’ve got… More >> - Products RSS Feed
- Products Email Notification
Checkout Requirements
In order to make a purchase from Train-ee you’ll need to first be registered and logged in, and you will also need a PayPal account.
Links to the downloadable files will be sent upon receipt of payment.
Note that if you pay with a credit or debit card and PayPal sees the transaction as an “eCheck”, there will be a 3-4 day delay before the transaction completes and you receive the download links.

I wonder why it’s not in the CP as standard?