I hope someone can answer “why” this is the case:
There are times I can use:
...
RewriteRule ^(.*)$ index.php/$1 [L]
and then there are times where the above doesn’t work and I must use:
...
RewriteRule ^(.*)$ index.php?/$1 [L]
the main difference being the addition of ?
… I typically see this happen on different system setups, fastcgi vs module vs cgi, but haven’t done enough setups to see the pattern.
I am guessing that it is related to how the apache/setup parses path/path_info data. Any thoughts are welcomed, ideally I’d like to have a solid explanation of why this is and when it occurs.
On the same thread … Sometimes Apache does not output PATH_INFO
environment var which might be the root cause of this, but I wonder why that is.
The ? is the marker of the beginning of the query string.
So basically your first rule rewrite a URL
"x"
to a file"x"
in the directoryindex.php
, the second rewrite a URL"x"
to theindex.php
file with parameter"x"
. [(BTW I don’t know how to retrieve a variable with no name in the file, usually you use?var=value&var2=value2
etc…)