Welcome Guest, Not a member yet? Register   Sign In
additional URL like base_url
#1

[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?
#2

[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.
#3

[eluser]new_igniter[/eluser]
Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB