CodeIgniter Forums
Q: mod_rewrite blog.mydomain.com to myController/Method directly ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Q: mod_rewrite blog.mydomain.com to myController/Method directly ? (/thread-54695.html)



Q: mod_rewrite blog.mydomain.com to myController/Method directly ? - El Forum - 09-20-2012

[eluser]Unknown[/eluser]
Hi guys,

I'm trying to use mod_rewrite to redirect one of the hostname to a controller/method directly,
with this .htaccess, but failed, it always give me the home page.

Code:
RewriteCond %{HTTP_HOST} blog.mydomain.com
RewriteRule ^$ index.php/blog/index [L]

If I browse to blog.mydomain.com/blog/index it works, but if I browse to blog.mydomain.com, apache always render me the page content of www.mydomain.com,

With RewriteLogLevel 1, I have no idea what's the problem:
Code:
/initial] (1) [perdir /var/www/] internal redirect with /index.php/blog/index [INTERNAL REDIRECT]
/initial/redir#1] (1) [perdir /var/www/] pass through /var/www/index.php
/subreq] (1) [perdir /var/www/] internal redirect with /index.php/blog/index [INTERNAL REDIRECT]

Am I missed some thing ?

thanks and regards