CodeIgniter Forums

Full Version: routes.php and 3rd level domain
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]lerio[/eluser]
Hi everyone,

i was wondering if there's a way to do this:

by typing -> http://word1.mysite.com
apache would call -> http://www.mysite.com/controller1/method1/word1
thus keeping http://word1.mysite.com in the url

i managed to to so by adding this to my .htaccess file

Code:
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}  !^(www.*)
RewriteCond %{HTTP_HOST}  ^(.*).mysite.com
RewriteRule ^(.*)$ /index.php/controller1/method1/%1 [QSA,L]

But i was looking for a way to use routes.php instead.

Any suggestion?

Thanks in advance

El Forum

[eluser]TheFuzzy0ne[/eluser]
Don't quote me here, but I don't think it can be done. To my knowledge, routes only work with URI segments, not with the HTTP Host, but I'm sure you could perhaps extend the router to do what you want.

El Forum

[eluser]lerio[/eluser]
Wow, that was fast!

Thanks anyway, i just wanted to leave my .htaccess as clean as i could.