Welcome Guest, Not a member yet? Register   Sign In
area.example.com - How to do Subdomains for Location-Based Database Filtering?
#4

[eluser]bretticus[/eluser]
If you want to "keep it in the framework"... You can use the server method of the input class:

Code:
$host = $this->input->server('HTTP_HOST');

If I were doing your project this is how I'd go about it:

First, I'd set up a wildcard in DNS that points to my IP.

Example of bind zone file:

Code:
ORIGIN example.com.
*  A  123.123.123.123

In your Apache config file under your virtual host:

Code:
ServerAlias *.example.com

Now, your only problem is when you use any framework method/function that builds URL's. Fortunately, you can extend CI via a MY_Config library. The method that all these URL building functions ultimately reference is site_url(). I'd probably look at the host header here and check it against that array. You can even modify this function to look at your array list because you are extending the CI_Config class so config items can be referenced as $this->item('name') in your MY_Config class. If I couldn't find a match, I'd go with a default again. That way your links will always reference an acceptable URI.

Good luck. Sounds like a fun project!


Messages In This Thread
area.example.com - How to do Subdomains for Location-Based Database Filtering? - by El Forum - 08-11-2010, 11:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB