CodeIgniter Forums
Client subdomains and custom domains - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Client subdomains and custom domains (/thread-56534.html)

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

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 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

First....try to lose the "www." in the url, and just use "", 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, 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.