Part of the EllisLab Network
   
 
htaccess for PHP-CGI hosting (and use segments with query strings)
Posted: 07 November 2008 09:11 PM   [ Ignore ]  
Sr. Research Associate
RankRankRankRankRank
Total Posts:  2634
Joined  06-10-2007

This custom .htaccess setup allows you to use uri segments and query strings together and may fix the issue everyone seems to have running CI on PHP-CGI hosting.

The great thing is that CI allows us to use a custom defined uri protocol. (thanks Rick Ellis)

If you want to try this setup then read on.

Set your custom uri protocol in application/config.php

$config['uri_protocol'] = "APP_PATH";

//enable query strings if required.
$config['enable_query_strings'] = TRUE;

Create your .htaccess file like so

RewriteEngine On

RewriteBase
/

RewriteCond %{ENV:REDIRECT_APP_PATH} !^$
RewriteRule ^(.*)$ - [E=APP_PATH:%{ENV:REDIRECT_APP_PATH}]

RewriteCond
%{ENV:APP_PATH} ^$
RewriteRule ^(.*)$ - [E=APP_PATH:/$1]

RewriteCond
%{REQUEST_FILENAME} !-f
RewriteCond
%{REQUEST_FILENAME} !-d
RewriteRule
^(.*)$ index.php [L]

You should be good to go. Good luck.

Credit goes to the folks @ TinyMVC forum for this solution.

 Signature 

URI Language Identifier | Modular Extensions - PHP5 | Modular Separation - PHP5 | Widget plugin | Access Control library

Profile
 
 
Posted: 08 November 2008 03:59 AM   [ Ignore ]   [ # 1 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2916
Joined  07-27-2006

That is some dope-ass shit, wired. Good on ya’ mate!

 Signature 

Check out the Template Library
Oh yeah, I tweet, too (regarding CodeIgniter on occassion).

Profile
 
 
Posted: 14 December 2008 11:36 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Avatar
Total Posts:  23
Joined  08-28-2008

nice, this one works!
I’m making a repost on my site.

cool ^_^

 Signature 

http://www.ikawka.com/

Profile
 
 
Posted: 08 March 2010 01:25 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  18
Joined  05-14-2009

it works for me partially. Now I can at least get into my home page. But that’s it. From there what ever link I click it refreshes the home page even thought the URL changes according to the new link I clicks.

Any help?

Profile
 
 
Posted: 10 March 2010 03:35 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  52
Joined  03-21-2006

Mine seems to work with just the two config changes. Is the .htaccess required or only in certain circumstances?

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120602 Total Logged-in Users: 51
Total Topics: 126642 Total Anonymous Users: 4
Total Replies: 665700 Total Guests: 469
Total Posts: 792342    
Members ( View Memberlist )
Newest Members:  paololukDarleneChadbourneRashadSargIvar89HonschowmtRetliffherzigerjudithleonbarrett