Link to home
Start Free TrialLog in
Avatar of amitk_28
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/username
while I am getting - /index.php/profile.html/index/username

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]

Open in new window

Avatar of Jagar Mohammad
Jagar Mohammad
Flag of Canada image

Check your application/config/config.php for this line: $config['url_suffix'] = ""; and make sure it is empty.

Let me know if that helped
ASKER CERTIFIED SOLUTION
Avatar of amitk_28
amitk_28

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial