Solved

Issue with .htaccess & username as subdomain

Posted on 2009-07-02
2
929 Views
Last Modified: 2012-05-07
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

0
Comment
Question by:amitk_28
2 Comments
 
LVL 5

Expert Comment

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

Let me know if that helped
0
 

Accepted Solution

by:
amitk_28 earned 0 total points
ID: 24922057
Changed the way to handle the situation. Not using .htaccess to get/pass the username. Instead in PHP added a function to parse the URL used and get the Username. Passing this username then to different functions.

Thanks for the help.
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now