![]() |
additional URL like base_url - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: additional URL like base_url (/showthread.php?tid=30512) |
additional URL like base_url - El Forum - 05-17-2010 [eluser]new_igniter[/eluser] Hello We are deploying a site using Amazon's Cloudfront, so Im looking to set a global variable that I can reference anywhere, which would have a domain as the value. i.e. media01.domain.com Is there a way for me to create in config something like this? additional URL like base_url - El Forum - 05-17-2010 [eluser]bretticus[/eluser] You can use the input class to get the host header anywhere without any extra config: Code: echo $this->input->server('HTTP_HOST'); Or vanilla PHP: Code: echo $_SERVER['HTTP_HOST']; Just make sure your DNS is setup to do wildcard sub domains and that your virtual host is setup to accept all host headers with a sub domain. This usually requires a separate IP address for this virtual host. I found this post just now via google that explains in more detail. EDIT: If the ServerAlias wildcard sub domain works (ServerAlias *.yourdomain.com) than you probably won't need your very own IP. EDIT: Oops, I changed out SERVER_NAME for HTTP_HOST. additional URL like base_url - El Forum - 05-17-2010 [eluser]new_igniter[/eluser] Thanks! |