Welcome Guest, Not a member yet? Register   Sign In
Domain & Subdomain Masking
#1

[eluser]psychobob[/eluser]
Hi all,

Thanks for looking at this. I will be having a codeigniter application that will be replacing a very non-global system that is written in ColdFusion. They have 15 exact replications of the same code but with different root folders. So each time I make a change to the code, I have to upload it 15 different times.

But making it a global system using codeigniter may not be possible... I hope someone can help me out here.

If a I have 3 foreign subdomains that I want to point to my codeigniter application

myaccount.xyz.com = approot/controllers/myaccount/
signup.xyz.com = approot/controllers/signup/
admin.xyz.com = approot/controllers/admin/

Now, I've done this successfully for a single domain by using the config file and setting the base_url to http://xyz.com

but unfortunately, I have to complicate things and try to service 15 different sites with the same application.

For example:
myaccount.xyz.com, myaccount.abc.com, myaccount.def.com, etc all point to approot/controllers/myaccount

There isn't much of a problem just pointing the sites there, it's that the base_url in the config file is static.

My thoughts are these:

1.) Grab the referring URL such as signup.xyz.com
2.) Break it apart:
Code:
$dom[1] = 'signup'; $dom[2] = 'xyz'; $dom[3]='com';
3.) Set session variables, such as
Code:
$this->session->set_userdata('controller') = $dom[1]
4.) Place that referring URL dynamically in the base_url of the config file. Such as:
Code:
$config['base_url'] = 'http://'.$this->session->userdata('controller'). '.' .$this->session->userdata('domain'). '.' .$this->session->userdata('extension').'/'.$this->session->userdata('controller')

I'm pretty sure there's a method for mod_rewrite that would make this simpler though...
something along the lines of this:
Code:
^/somepath(.*) http://otherhost/otherpath$1 [P]

But I am not strong on the server stuff, so I'm not exactly sure I understand mod_rewrite.

Any help would be very appreciated.


Messages In This Thread
Domain & Subdomain Masking - by El Forum - 10-20-2010, 01:29 PM
Domain & Subdomain Masking - by El Forum - 10-21-2010, 12:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB