Reputation: 2532
I have a single CI application hosted in say abcd.com
and it has different pages like
now the requirement is when user access one.abcd.com
as url (in address bar) then it will display abcd.com/pages/one
content
EDIT : but the url in address bar should remain
one.abcd.com
similarly two.abcd.com
should display abcd.com/pages/two
content
how that can be achieved ? as routing only accept the path name excluding domain
Upvotes: 1
Views: 82
Reputation: 143966
Try adding these rules to the htaccess file in your document root:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?abcd\.com$ [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.abcd\.com$ [NC]
RewriteRule ^/?$ /pages/%1 [L]
This will only work if you have *.abcd.com
all pointing to the same document root.
Upvotes: 2