For further clarity and thoroughness, I had to engineer another approach-based solution. As an added bonus, the shared hosting environment we had to use was forced to use FastCGI, and on top of that wouldn't allow us to modify any CGI or PHP configurations. Really unhelpful I know.
As has been made clear by other answers and discussions, the problem seems to be that when using a CGI-based implementation of PHP, the $_SERVER['PATH_INFO']
variable is not available, but it is unfortunately required by ExpressionEngine when trying to route requests, specifically when trying to navigate without the pesky index.php
string being present in the URL.
So in the end, what worked for me was this 3 step 'custom' approach:
- First, in
ExpressionEngine > CP Home > Admin > System Administration > Output And Debugging
, I set Force URL query strings to No.
- Next, as mentioned in previous answers, I changed the
.htaccess
directive from RewriteRule ^(.*)$ /index.php/$1 [L,QSA]
to RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]
(extra ? after index.php).
Finally, I added this piece of custom PHP code to the top of site root's index.php
file to "force" the $_SERVER['PATH_INFO']
variable into accurate existence:
<?php
$path = $_SERVER['REQUEST_URI'];
$pos = strpos($path, '?');
if ($pos !== false)
$path = substr($path, 0, $pos);
$_SERVER['PATH_INFO'] = $path;
/**
* ExpressionEngine - by EllisLab
...
...
I hope this helps someone! I really pulled my hair out trying to find somewhat more elegant solutions!