CodeIgniter Forums
routes.php and 3rd level domain - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: routes.php and 3rd level domain (/showthread.php?tid=15930)



routes.php and 3rd level domain - El Forum - 02-19-2009

[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


routes.php and 3rd level domain - El Forum - 02-19-2009

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


routes.php and 3rd level domain - El Forum - 02-19-2009

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

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