CodeIgniter Forums
Rewrite a subdomain - 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: Rewrite a subdomain (/thread-20293.html)



Rewrite a subdomain - El Forum - 07-04-2009

[eluser]Flak[/eluser]
I'm playing but can't make it work.

I have code igniter on subdirectory of a subdomain

ci.domain.com/ci/index.php/welcome


I want to rewrite to ci.domain.com/welcome

So when a user can go via ci.domain.com/welcome

any idea?

thanks


Rewrite a subdomain - El Forum - 07-04-2009

[eluser]Flak[/eluser]
This is a piece of code that I am rolling:

____
Code:
<IfModule mod_rewrite.c>

# handle domain root and skip subfolders
RewriteCond %{HTTP_HOST} ci.domain.com
RewriteCond %{REQUEST_URI} !^/ci
RewriteCond %{REQUEST_URI} \..+$
RewriteRule ^(.*)$ ci/$1 [L]

# handle files in subfolders
RewriteCond %{HTTP_HOST} ci.domain.com
RewriteCond %{REQUEST_URI} !^/ci
RewriteRule ^(.*)$ ci/$1/ [L]
</IfModule>
____