CodeIgniter Forums
htaccess on PHP fastcgi - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: htaccess on PHP fastcgi (/showthread.php?tid=31711)



htaccess on PHP fastcgi - El Forum - 06-29-2010

[eluser]JoostV[/eluser]
I had some problems with mod_rewrite on a shared hosting account (xxlwebhosting) where the hoster runs PHP as a fastcgi service.

When I tried to use CI's SEO URLs, I got an error 'No input file specified'.

I found the solution here: http://www.terencechang.com/2008/08/28/codeigniter-no-input-file-specified-php-5-apache-2/

This .htaccess works like a charm, notice the question mark behind index.php, that's the trick Smile Thought I'd share.

Code:
RewriteEngine On

# Existing files and directories remain accessible
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.* - [L]

# Redirect the rest
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [QSA,L]



htaccess on PHP fastcgi - El Forum - 06-29-2010

[eluser]Phil Sturgeon[/eluser]
We've had to do this in PyroCMS for a while now. To get your .htaccess working for both, try this snippet instead of the last line:

Code:
<IfModule mod_php5.c>
        RewriteRule ^(.*)$ index.php/$1 [L]
    </IfModule>

    <IfModule !mod_php5.c>
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>



htaccess on PHP fastcgi - El Forum - 06-29-2010

[eluser]JoostV[/eluser]
Works like a charm, thanks!