?
Solved

Issue with .htaccess & username as subdomain

Posted on 2009-07-02
2
Medium Priority
?
942 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

770 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