CodeIgniter Forums

Full Version: Codeigniter subdomains
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Citizen[/eluser]
Lets say I have my controllers organized as such:

/news/main.php
/news/recent.php
/business/main.php
/business/recent.php

How can I get news.domain.com to load the main.php controller from my /news/ controller directory?
And then news.domain.com/recent would load /news/recent.php controller

El Forum

[eluser]ranjudsokomora[/eluser]
Hello Citizen,
You would need to modify the router class.
I'll see if I can write an example of what you are looking for. I'll post it here in a couple of hours.

El Forum

[eluser]Citizen[/eluser]
[quote author="ranjudsokomora" date="1310527443"]Hello Citizen,
You would need to modify the router class.
I'll see if I can write an example of what you are looking for. I'll post it here in a couple of hours.[/quote]
Thanks, any help would be appreciated.

El Forum

[eluser]Aken[/eluser]
Redacted. See below.

El Forum

[eluser]Citizen[/eluser]
[quote author="Aken" date="1310824675"]Don't even need to mess with routes - a correctly-configured .htaccess file would do the trick.[/quote]

How would I do that without having to have a rule for every page within the subdirectory?

El Forum

[eluser]Aken[/eluser]
My mistake - this would be better suited with DNS. See: http://stackoverflow.com/questions/58612...access-php

El Forum

[eluser]Citizen[/eluser]
Thanks, guys, but I'm still not sure what to do.

If it helps: I have a finite list of subdirectories that I want to use, only about 5 or so. I'm not looking to create a wildcard subdomain catcher.

And I'm aware of how to create subdirectories through DNS or with htaccess, but I'm not sure what the best practice would be for codeigniter. I'm hoping someone can tell me what the best way to do this with codeigniter.