.htaccess issues: No input file specified
Solution 1
I was beating my head up against this as well. I'm also installing Code Igniter.
The goocher was no RewriteBase. Here's my .htaccess:
DirectoryIndex index.php
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
Solution 2
The Problem
I encountered a similar problem just now and unfortunately none of the answers in this thread helped:
Zend Framework was giving out "No input file specified.", but:
- The default RewriteBase was just fine, and adding
RewriteBase /
did not help - It's a shared hosting server and only FastCGI is available (no ability to switch to SuPHP)
- AcceptPathInfo was on
- There was no problem with URL rewriting in general on the server
So the answer came from the following site: https://ellislab.com/forums/viewthread/55620/P15 [dead link] (even though the host is not DreamHost).
The Solution
Apparently all you need to do is replace this line:
RewriteRule ^(.*)$ index.php/$1
With this:
RewriteRule ^(.*)$ index.php?/$1
Problem solved.
Solution 3
This worked for me:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
After index.php
, the question mark is important!
Solution 4
Try if it works with a simpler RewriteCond
; like one that rewrites only everything that isn't an existing file/folder/link:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ /index.php/$1 [R,L]
Solution 5
Go Daddy Users:
- login to your Go Daddy Account
- click on your hosting account.
- go to Settings > File Extensions Management
- change .php and .php5 to run under PHP5.2X (instead of PHP5.2xFastCGI)
SOLVED!!!!
Related videos on Youtube
Michal M
Web Developer I use: OOPHP MySQL Perl JavaScript HTML5 CSS3 I'm on: twitter zerply
Updated on September 08, 2020Comments
-
Michal M over 3 years
Can someone help me with this? I'm feeling like I've been hitting my head against a wall for over 2 hrs now.
I've got
Apache 2.2.8 + PHP 5.2.6
installed on my machine and the.htaccess
with the code below works fine, no errors.RewriteEngine on RewriteCond $1 !^(index\.php|css|gfx|js|swf|robots\.txt|favicon\.ico) RewriteRule ^(.*)$ /index.php/$1 [L]
The same code on my hosting provider server gives me a 404 error code and outputs
only: No input file specified.
index.php is there. I know they have Apache installed (cannot find version info anywhere) and they're running PHP v5.2.8.I'm on
Windows XP 64-bit
, they're running someLinux
withPHP
inCGI/FastCGI
mode. Can anyone suggest what could be the problem?PS. if that's important that's for
CodeIgniter
to work with friendly URLs.
Update1:
mod_rewrite
is installed and on.What I've noticed is that if I change in
RewriteRule
to/index.php?$1
(question mark instead of forward slash) it goes into an infinite loop. Anyway, using question mark isn't an option asCodeIgniter
(required) is not going to work this way.Homepage also works when I request index.php directly:
example.com/index.php
I'm starting to think it might be apache thinking that once the trailing slash is added it is not a file anymore but a folder. how to change such a behaviour?
Update 2:
I was wrong.
Apache handles these URLs correctly.
Requestinghttp://example.com/index.php/start/
(homepage) or any other valid address works.
Seems thatApache
is just not forwarding the query for some reason.
Update 3:
Just to be clear what I'm trying to achieve.
I want to rewrite addresses like that:http://www.example.com/something/ => http://www.example.com/index.php/something/ http://www.example.com/something/else/ => http://www.example.com/index.php/something/else/
-
Michal M over 14 yearsNo. mod_rewrite is on. What I've noticed is that if I change in RewriteRule to /index.php?$1 (question mark instead of forward slash) it goes into an infinite loop. homepage also works when I request index.php directly: example.com/index.php I'm starting to think it might be apache thinking that once the trailing slash is added it is not a file anymore but a folder. how to change such a behaviour?
-
Michal M over 14 yearsusing ? mark isn't an option. CodeIgniter won't work this way.
-
Michal M over 14 yearsRe your edit. That's the point of not having $ at the end. So that any URLs starting with what's in the brackets are not being rewritten to index.php (inc. index.php and index.php/anything/) otherwise it will not work.
-
Michal M over 14 yearsthis works for the homepage: example.com/, not for anything else like example.com/something/
-
Michal M over 14 yearsBtw. I asked at SeverFault. not much luck there either and less answers/ideas.
-
kkyy over 14 yearsOh, now I get it... you want to REDIRECT the requests instead of just REWRITING... (if I understood your update #3 correctly :) Try adding [R] into the end of the rewriterule, see my updated answer.
-
Vicky over 8 yearsanother problem you have created if you are using this function
basename=$_SERVER['PHP_SELF'];
which return only index.php -
Bradmage about 8 yearsThis was the fix for my base installation of ispconfig 3. Worked fine on wamp server.
-
Danon about 7 yearsI don't know why, but this worked perfectly for me :)
-
Joey Harwood over 6 yearsThe .htaccess for the live server is unchanged from the accepted answer. If there's a good reason to provide a different explanation for the Localhost you should elaborate on that.
-
Gladen about 6 yearsQuestion mark fixed it for me with getting my site to work on ISPConfig.