Part of the EllisLab Network
   
2 of 2
2
Dreamhost => [No input file specified]
Posted: 10 April 2008 09:44 AM   [ Ignore ]   [ # 16 ]  
Summer Student
Total Posts:  2
Joined  04-10-2008
DavidCassidy - 04 July 2007 05:13 PM

Actually, it was a tiny addition to the .htaccess file that finally solved it. So, for all you Dreamhost users out there, use this to strip that nasty index.php string from your URLs:

RewriteEngine On
RewriteCond
$1 !^(index\.php)
RewriteRule ^(.+)$ index.php?$1 [L]

It seems the question mark on teh third line is the key.


Just wanted to add for the record that this solution also works for ICDSoft host provider.

Profile
 
 
Posted: 25 May 2008 06:06 PM   [ Ignore ]   [ # 17 ]  
Summer Student
Total Posts:  12
Joined  05-22-2008

I am just curious. Does this problem happened to other frameworks too ? such as Zend framework, Cake and so on. I am very very tired of getting every little things fixed in the host environment. I am feeling like making “The framework” on my own!!

Profile
 
 
Posted: 27 October 2008 08:03 PM   [ Ignore ]   [ # 18 ]  
Summer Student
Total Posts:  3
Joined  07-02-2008
llbbl - 08 December 2007 06:26 PM

RewriteRule ^(.*)$ index.php?/$1 [L]

While the above works, and fixes the issue in most cases, I came across a problem where if I wanted to allow URL parameters (enabling query strings), the $_GET array was not being populated correctly because something like this:

http://mysite.com/controller/action/?var=val&var2=val2

On Dreamhost (with PHP as CGI) using the RewriteRule above turns into:

http://mysite.com/index.php?/controller/action/?var=val&var2=val2

Which causes CodeIgniter (due to the extra ’?’) to have the $_GET array not be populated as expected (with var,var2 as keys and val,val2 as values).

The solution I came up (for us with Dreamhost, running PHP 5.2+ as CGI) was to repopulate the $_GET array using the REQUEST_URI by creating an extension of of the CI_Input class. The solution is to create a MY_Input.php (as explained by a previous poster) under application/libraries:


<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class
MY_Input extends CI_Input {

    
function __construct(){ //Or MY_Input()
        
        //get the URL query string from the REQUEST_URI
        
$get_string = array_pop( explode('?',$_SERVER['REQUEST_URI'],2) );
        
//parse the pairs of parameters
        
$pairs_array = explode('&',$get_string);
        
/*
        adding these values to the GET array before sending it to the
        Core Input class.
        */
        
foreach($pairs_array as $pair){
            
list($key,$value) = explode('=',$pair);
            
$_GET[$key] = $value;
        
}
        
//continue as normal    
        
parent::CI_Input();
        
        
}
}

You will still have to set the following in your config file (as explained previously in this thread):

$config['uri_protocol']    = "AUTO";
$config['enable_query_strings'] = TRUE;

I’m sure someone can write better code than I can. I just wanted to help other CI deployments, since I didn’t find a solution to this issue.

Profile
 
 
   
2 of 2
2
 
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 719, on June 06, 2008 10:16 AM
Total Registered Members: 64453 Total Logged-in Users: 27
Total Topics: 80958 Total Anonymous Users: 0
Total Replies: 435680 Total Guests: 190
Total Posts: 516638    
Members ( View Memberlist )