We're revamping a site that has a url structure of http://mysite.com/partner_name. When that first segment matches a partner name, their current custom site changes all urls and logo.

In our case on EE we're using freebie and switchee. We add each partner name (they're not too many) as freebie segments, and add them to a comparison case with switchee. That works great for the first page, but all links are still mysite.com/my_url, when ideally they'd be mysite.com/partner_name/my_url.

Is there any way we can do the comparison with switchee, and save mysite.com/freebie_1 as {site_url} when there's a match? Do we need php on the template?

Thanks in advance!



2 Answers 2


I've seen multi-language site implementations that deal with similar issues since you essentially want something like this:


And depending on the URL, you want {site_url} to return the language code segment as well as the domain (http://mysite.com/en/).

Here's a pretty good write-up of how to accomplish this:


Essentially, you create separate directories for the first segment with copies of your index.php files in them.


Then you modify each index.php file change the site_url global variables.

$assign_to_config['site_url'] = 'http://mysite.com/fr';

Here's a nice slide presentation on the same technique: Multi-Language Websites in ExpressionEngine

Also, if you are using something like Focus Lab's Master Config, or EE-Garage's Config Boostrap, you can possibly override the {site_url} with some PHP conditionals. I haven't tried this technique before personally.

Here's a similar question about doing this: Set “site_url” Config Variable in index.php


Try this:

$this->EE =& get_instance();

$this->EE->confi->config['site_url'] = "New Site URL";

Your Answer

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

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