Getting the correct path to our secure subdomain
We have a site that will be going live soon that has an area for members and signup that is secure, and hosted elsewhere. It will live at
https://secure.prontocycleshare.com whereas the rest of the site will live at
http://www.prontocycleshare.com/Is there a way to use the My Url helper to be able to use the internal linking syntax <?=site_url('internal-link')?> for this subdomain? I feel like that is a better practice than hard coding in case we ever move domains etc.
PS Thanks for putting up with my recent uptick in questions as we launch a new site using the new 1.1 for the first time. It is much appreciated.
Comments
$config['base_url'] = BASE_URL;
Also, more as an FYI, the BASE_URL is set in the fuel_constants.php file. Does that help?
What I'm trying to figure out is if there is a way to add a parameter to the internal link or something like that so that From either the secure or non-secure site you can reach internal pages in either site. So that it doesn't matter which site I'm on something like this:
<?=site_url('en/map', secure)?>
would take me to
https://secure.prontocycleshare.com/en/map
Just the same as
<?=site_url('jobs')?>
or perhaps
<?=site_url('jobs', nonsecure)?>
would take me to
http://www.prontocycleshare.com/jobs
function url($uri, $base_url = NULL, $https = NULL, $language = NULL) { $CI =& get_instance(); $CI->config->set_item('base_url', $base_url); return site_url($uri, $https, $language); }
<a href="{url('resources')}">bike shops</a>
I get this error:
An Error Was Encountered
Call to a disallowed php function : url
Is there a way I can allow this function?
$config['parser_allowed_php_functions']
We set up a constant for the secure url so that we could use SECURE_BASE_URL and BASE_URL as the second parameter if/when necessary when creating these links (e.g. <?=url('map', SECURE_BASE_URL)?>
but I forgot that constants don't parse into the Fuel admin (this has come up before when we've created urls with the system name etc)
Is there any way to remedy this? Is this a feature others have asked for? Seems like folks would have...
$vars['secure_base_url'] = SECURE_BASE_URL;
Then in the CMS you can try this:
{url('map', $secure_base_url)}
We eventually ended up with this function:
function url($uri = '', $base_url = BASE_URL) { $CI =& get_instance(); $CI->config->set_item('base_url', $base_url); return site_url($uri); }
But for certain elements elsewhere on the page, the base_url is not reset. What I mean by that is if I use a new base_url on the main logo of the page it persists in elements such as fuel_nav items or form_open.
A fix we made in the meantime was to add a line to the fuel_helper file in teh fuel_nav function itself
$CI->config->set_item('base_url', BASE_URL);
but this seems less than ideal going into and changing a core file.Do you have any recommendations about how we could add a resetting of some sort to our function itself?
Initially we made that separation because a partner was handling the member site, now we are also doing so on our own sites to get the non-member, marketing site completely out of PCI scope.
For reference:
function url($uri = '', $base_url = FALSE) { if ($base_url == FALSE ) { return site_url($uri); } $CI =& get_instance(); $CI->config->set_item('base_url', $base_url); $url = site_url($uri); $CI->config->set_item('base_url', BASE_URL); return $url; }