Solved

Issue with .htaccess & username as subdomain

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
The viewer will learn how to count occurrences of each item in an array.
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 …

830 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