amitk_28
asked on
Issue with .htaccess & username as subdomain
I am working on a site which sits on codeigniter framework. I have to now give users "username as subdomain". Have added the DNS entry, the ServerAlias - stuck up with a redirect in .htaccess. Am using the following code in my .htaccess.
My request URL will be - http://username.mydomain.com/profile.html
I want the path to be translated to - /index.php/profile/index/u sername
while I am getting - /index.php/profile.html/in dex/userna me
Somehow i am not able to get rid of .html
NOTE: I do not want to hardcode "profile" as it will be dynamic. Will be adding more RewriteCond to the code once get this working
Any and all help will be appreciated.
Thanks in advance.
My request URL will be - http://username.mydomain.com/profile.html
I want the path to be translated to - /index.php/profile/index/u
while I am getting - /index.php/profile.html/in
Somehow i am not able to get rid of .html
NOTE: I do not want to hardcode "profile" as it will be dynamic. Will be adding more RewriteCond to the code once get this working
Any and all help will be appreciated.
Thanks in advance.
RewriteCond %{HTTP_HOST} !^(www\.)?mydomain\.com$ [NC]
RewriteCond $1 ^profile
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)
RewriteRule ^(.*) /index.php/$1/index/%2 [L]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Let me know if that helped