Domain routing possibilities in CI? - 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: Domain routing possibilities in CI? (/showthread.php?tid=7248) |
Domain routing possibilities in CI? - El Forum - 03-31-2008 [eluser]stevefink[/eluser] Hi all, Super quick question. I have a few URLs that look like the following: http://www.example.com/users http://www.example.com/admin http://www.example.com/partners I understand how URI routing works on CI's internal engine in routes.php in order to be able to manipulate matters, however -- is it possible to use mod_rewrite + CI routing to have users point to say: http://users.example.com admin to http://admin.example.com .. etc? All under one CI install? if I just setup my mod_rewrite rules properly will it know which controller is responsible for handling the mapping? Thanks! Domain routing possibilities in CI? - El Forum - 03-31-2008 [eluser]Pascal Kriete[/eluser] Sure it is, but it's ... iffy. The mod rewrite isn't a pretty one. This should get you started: Code: RewriteCond %{HTTP_HOST} ^(admin|users|partners).example.com$ Domain routing possibilities in CI? - El Forum - 03-31-2008 [eluser]Sean Murphy[/eluser] Sure! Something along these lines should work: Code: RewriteEngine on Domain routing possibilities in CI? - El Forum - 04-11-2008 [eluser]stevefink[/eluser] Thanks for the reply! Would these rules have to precede the default .htaccess rules which remap all to index.php? Domain routing possibilities in CI? - El Forum - 04-11-2008 [eluser]Sean Murphy[/eluser] Yes, and Code: RewriteRule ^(.*)$ /index.php?/%1/$1 [L] Code: RewriteRule ^(.*)$ index.php/$1 [L] Domain routing possibilities in CI? - El Forum - 04-11-2008 [eluser]stevefink[/eluser] Sure, I'm cleaning this up currently -- my mod_rewrite is extremely rusty .. but it looks something like this thus far: Code: RewriteEngine On Thanks again. :-) Domain routing possibilities in CI? - El Forum - 04-11-2008 [eluser]Sean Murphy[/eluser] I think this will do it. Code: RewriteEngine On Code: RewriteCond %{REQUEST_FILENAME} !-f Glad I could help! Domain routing possibilities in CI? - El Forum - 04-11-2008 [eluser]stevefink[/eluser] Hey Sean! Thanks for the help. Unfortunately it's a no go, but I've enabled RewriteLog and going to go through it step by step to see why it's not catching the first condition set. Truly odd! It could be the way I have VirtualHosts setup, so I'll need to dig in deeper to make sure it's properly rendering %{HTTP_HOST} (the rules might be correct, or they might not.) Thanks again. Domain routing possibilities in CI? - El Forum - 04-11-2008 [eluser]Sean Murphy[/eluser] Sorry, I haven't tested it. BTW, Code: RewriteRule ^(.*)$ /index.php?/%1/$1 [L] Code: RewriteRule ^(.*)$ /index.php/%1/$1 [L] Domain routing possibilities in CI? - El Forum - 04-11-2008 [eluser]stevefink[/eluser] I've also tried the following, unfortunately just returns HTTP status code 500: Code: RewriteEngine On |