Reputation: 11
Got a controller in codeigniter who handles different sub sites.
site/index/1
fetches content for subsite A
site/index/2
fetches content for subsite B
Now we decided to register domain names for these sub sites.
so what we need:
http://www.subsite1.com -> default controller should be site/index/1
without the site/index/1
in the URI.
http://www.subsite2.com -> default controller should be site/index/2
without the site/index/2
in the URI.
I fiddled and tried to play with routes.php
but getting nowhere..
Can somebody point me in the right direction?
Upvotes: 1
Views: 492
Reputation: 10077
in your routes.php file you need to set this:
$route['default_controller'] = ($_SERVER['SERVER_NAME'] == 'http://www.subsite1.com' ? "site/index/1" : "site/index/2");
and if your trying to force it somewhere when some weird url is types in:
$route['404_override'] = ($_SERVER['SERVER_NAME'] == 'http://www.subsite1.com' ? "site/index/1" : "site/index/2");
and for the second one just switch it to 2
Upvotes: 1