CodeIgniter Forums
Single application with multiple subdomains - how? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Single application with multiple subdomains - how? (/thread-32920.html)



Single application with multiple subdomains - how? - El Forum - 08-09-2010

[eluser]WinkingFrog[/eluser]
Hi folks, looking for a pointer or two...

We are looking at building an application that will use subdomains to identify a region for access and data filtering etc. I have had a dig through various forum posts and google results and I am aware that there is a fair bit of info out there, however it all seems either to conflict with similar concepts/solutions or specific to an application.

Here is what we are looking at achieving...

An application designed for use by UK based users, with a subdomain identifying which region of the application the user wishes to view. It will ultimately have a large number of subdomains/regions available so we would rather not use a separate application folder for each, as it would make application updates a pain in the ....

The subdomain will obviously require to be identified internally within the app to allow for the selection of relevant data etc.

I am 100% sure this can be done, I am just looking to those who have played with this concept or have a solid understanding of how it can be best achieved.

Any takers?


Single application with multiple subdomains - how? - El Forum - 08-09-2010

[eluser]frist44[/eluser]
You could do something like UPS where they ask you from the start your region and go into part of the app that caters to that content. Drop a cookie on their machine for that region, so it's remembered next time they come back.

You could also take a domain and rewrite the URL to a controller or something that would identify a region based on the subdomain and know to serve up the UK content.


Single application with multiple subdomains - how? - El Forum - 08-09-2010

[eluser]jwright[/eluser]
I'm currently working on something similar. I have a working prototype based on this tutorial ...

How to: Multi-site CodeIgniter Set-up

http://philsturgeon.co.uk/news/2009/06/How-to-Multi-site-CodeIgniter-Set-up

I hope that helps