CodeIgniter Forums
Client subdomains and custom domains - 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: Client subdomains and custom domains (/thread-56534.html)



Client subdomains and custom domains - El Forum - 12-28-2012

[eluser]malzahar[/eluser]
I have a CodeIgniter application that I've been using for clients that has proven to be quite successful. As of right now it is installed individually on each client's own web hosting servers however I'm planning on making this product a hosted service available to the public at a monthly fee. I'm in the process of converting the code and am wondering how to handle subdomains and custom domains for this application. I've never had to do anything like this and was wondering if anyone had in any insight on how this could work with codeigniter.

Basically when a user registers they would have their own subdomain like www.username.myproduct.com. Similarly, clients could use their own domains in place of this method. I know this is a common practice in many web applications but I'm not just not sure where to begin.

Any help would be greatly appreciated.


Client subdomains and custom domains - El Forum - 12-28-2012

[eluser]vitoco[/eluser]
First....try to lose the "www." in the url, and just use "http://client.myproduct.com", second, the way that i handle subdomains it's using a single installation of CI, and pointing all sudomains to that path, then either on pre_controller or post_controller_constructor, you can validate and set all client specific ( according to the subdomain ) variables including reseting the base_url parameter.

About using the client domain, i suggest you to use a sudomain ( there's a way to redirect a subdomain to a specific ip ) so your url will be http://myproduct.clientdomain.com, then you don't have to manage anything on their end, just on yours, delimiting responsabilities and focusing your time on your app.

Hope it helps.

Slds