Solved

Issue with .htaccess & username as subdomain

Posted on 2009-07-02
2
927 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
There is a huge demand for CodeIgniter among the PHP web developers due to its dynamic features and benefits these days. It is one of most popular and agile open source PHP framework for creating robust web applications in PHP web development field.…
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.

746 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

13 Experts available now in Live!

Get 1:1 Help Now