We are often caught by having links in Message Templates that work on live, but then incorrectly take us to the live site when testing on dev - which can result in confusion or worse, errors or incorrect conclusions.

Anyone know if there is such a token but it just isn't visible via the token selector?

3 Answers 3


No, there is no token for base URL is available in civicrm. If you want to use base URL in templates, you can try this:

 // Declare $config;
 $config = & CRM_Core_Config::singleton();

 $baseUrl = $config->userFrameworkBaseURL;

This will gives you base URL and use variable "$baseUrl" in your template.

Another way is, you can create your custom token for base URL.Refer following link: http://wiki.civicrm.org/confluence/display/CRMDOC/Customized+%28and+Custom%29+Tokens


There is a JIRA ticket that seems related here but no evidence of an actual resolution to it.

  • I heard back from that company who said Joeren was no longer there and didn't offer any other suggestions.
    – petednz - fuzion
    Dec 21, 2015 at 18:16

I had the same requirement (moving email templates between test and production). So I created a small extension that adds a Site URL token. You can find it here https://lab.civicrm.org/kainuk/siteurl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.