No Input File Specified -- Strange fix!!

Permalink 2 users found helpful
Hi all,

Had this problem with my host (heart internet) when I first started using C5 -- kept getting that annoying 'no input file specified' error when trying to use mod_reqrite. Played with it, trial & error, a found that this worked (might work for some of you too:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .$ index.php/$1
</IfModule>

Heart just upgraded to PHP 5.2.10 and this has just stopped working -- URLs in the browser change as they're supposed to when links are clicked, but the homepage would just get re-loaded again and again. Very annoying.

After hours of fiddling trying to come up with another solution, completely by accident I discovered that if you pass the full URI through another php document in your host root, it works!! Code below is now working for me (redirect.php is a completely blank .php file I created for the time being).

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .$ /redirect.php/$1
</IfModule>

Anyone have ANY idea why this might work??! Would love to know if it's a long-term solution...and just HOW IT WORKS!? Haha.

arcanepain
View Replies:
olay replied on at Permalink Reply
olay
Hi I'm also on heart and weirdly / coincidentally I solved the same problem today using a different method...

See my post at the bottom of this thread:

http://www.concrete5.org/community/forums/customizing_c5/pretty_url...

I'd love to hear from someone about which one is the more kosher fix / workaround
arcanepain replied on at Permalink Reply
arcanepain
Interesting, Olay. I'll try that in the morning.

My complete fluke one works without my having to edit request.php or anything, which has that going for it, but I can't for the life of me figure out why specifying any random .php file (don't know, but quite possible a .html file or any other would work too) does the job. I might try both through FireBug or something and see which responds faster -- either way is a bit hack-y, but if we can't have neat and sensible i'll take fast!

I'll let you know the results.

I did bring it up with Heart as my previous solution worked fine up until they updated from PHP 5.2.9 to 5.2.10 at 10:00 today (30th). No idea what changed, and they weren't about to be helpful about it. They also turn off short_tags in PHP, but that's a simple fix (threw me for a bit though...was just more agitated when I couldn't navigate the actual site!!).
arcanepain replied on at Permalink Reply
arcanepain
Well...ok, we're talking milliseconds here, so speed-wise we'll call it a draw, but i'd rather go with yours. In an ideal world hacks to Concrete's core library files obviously aren't ideal but, considering that I have no idea how/why my 'insert random php script here' fix works, i'm inclined to go with your method, as at least it looks kindof right and makes sense!
olay replied on at Permalink Reply
olay
Was all down to the clever people in that post — I simply used trial and error to see which one of theirs worked!

As you say, i'd rather not edit the the core like that, makes it a rather long list of things to do before / install or upgrade.

Incidentally what is the short_tags you refer to Heart turning off? (i'm not very php savvy so don't know what different things on the server do)

What effect will this have and, should I need, what is the fix?

Many thanks
abovecreative replied on at Permalink Reply
abovecreative
Wow, after scratching my head and numerous emails to Heart Internet I stumbled across this post. Finally my pretty urls are working. I have actually gone with arcanepain's solution as I don't like messing with any core code in case it gets altered in an update.
Not sure how the solution works though but thankfully it does, have you come across any problems.

Thanks.
aeroclown replied on at Permalink Reply
aeroclown
Basically like asp, you can use short tags as well as asp style tags in your php files. However for that code be recognized as executable code the php configuration MUST allow short tags and asp style tags depending on which you are using. If they are not enabled nothing will execute, the server will view the code as plain text and spit it out as plain text.

Short tags for example look like this <? ?> <- short tags, instead of <?php ?> <- normal tags.
TMDesigns replied on at Permalink Reply
TMDesigns
i had this problem and i used for method to fix it and it worked a treat.

viva la redirect.php
p4square replied on at Permalink Reply
What a strange trip - worked for me as well. I'm going to talk to my hosting provider re. this. I don't like hacking core bits either.
simphax replied on at Permalink Reply
Hi!
I had this problem today, and this did not solve the problem, though just adding a question mark after index.php did it! =)

So its like
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
misiek1928 replied on at Permalink Reply
Worked for me too! Thanx.
gewald replied on at Permalink Reply
gewald
I have a site running on Rackspace, but sadly the extra question mark didn't fix it for me.
geared replied on at Permalink Reply
I too used this and it worked on the hosting provider fatcow
vernb replied on at Permalink Reply
vernb
Why do these things take ages and ages to find????

The MAGIC question mark worked for me too!

I am working on my first 5.5.1 website (previously used 5.4) and keep finding fixes needed to make things work.

Thanks for that simphax

Best wishes
Vern
ericob replied on at Permalink Reply
That's very interesting.

Thinking about it, the urls that look like "... index.php/page_name/" ARE queries. Right? So without switching on Pretty URLs, I tried both "... index.php?/page_name/" and "... index.php?page_name/" Guess what, they both worked.

I activated Pretty URLs, then edited the htaccess file and replaced the slash after index.php with a question mark and FINALLY I have now pretty URLs.

FYI, I'm running Concrete5 version 5.4.2.1.
oakleafg replied on at Permalink Reply
Be warned that i'm with Heart and all my sites (there is quite a few of them) have just stopped working today. Turns out using the following code in the htaccess doesn't work anymore.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .$ /redirect.php/$1
</IfModule>

Using the correct concrete5 pretty urls code now works, problem is i'll now have to go through all the sites changing the htaccess!
moth replied on at Permalink Reply
moth
Me too.

Seems Heart have changed something across their infrastructure and basically broken a ton of C5 sites that I have there.

No notifications, no status update - just serverwide config changes with not a care in the world... just like crazy internet cowboys.
moth replied on at Permalink Reply
moth
C5 default rewrite code as stated above now seems to work;

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
ranxem replied on at Permalink Reply
ranxem
Hi 'moth',

I recently upgraded for new version on C5 and permissions got really messed up.
It also deactivated the following Add Ons:

'Advanced Guestbook Comment' is not working, 'Simple Blog Post' is not working, 'Popup Menu' is not working.

Please see attachment.

Thank you in advance!!
moth replied on at Permalink Reply
moth
I don't see an attachment.

However, if those are market place blocks you're better of contacting the sellers.