Dynamic Base Url |
[eluser]Gregory Kornblum[/eluser]
Running into issues with the hard-coded method of setting the base url? Yeah, me too. So I made a wiki tips and tricks entry to help you simplify this setting. http://codeigniter.com/wiki/Dynamic_Base_Url/
[eluser]skunkbad[/eluser]
This seems to be a nice solution, but for me, my development server is set up with all of the websites as sub-directories of http://rbg72.web. I could probably configure my WAMP to run with name based virtual hosting or something, but for me there is something more simple. I have created a checklist for moving to another server. Because other things need to be changed, such as .htaccess and config.php, I always find myself configuring something.
[eluser]WanWizard[/eluser]
In our CMS-to-be, base_url is defined as: Code: $config['base_url'] = (isset($_SERVER['HTTPS']) ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . ROOT; The constant ROOT is defined in index.php, as: Code: define('ROOTPATH', realpath(dirname(__FILE__)) . '/'); This will handle website installations in subdirectories of the DOCROOT.
[eluser]Gregory Kornblum[/eluser]
Nice, your's is more thorough. That should be included in the framework's next release. What value does the hard-coding provide anyway?
[eluser]Gregory Kornblum[/eluser]
I updated the wiki with your version and gave you credit. Thanks! |
Welcome Guest, Not a member yet? Register Sign In |