Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Url rewriting htaaccess
  • Hey, i have been developing and deploying usualy on cgi server, but now i have to deploy on a non cgi server, where the hta acces executes the mod_php5.c part of htaacces, wondering why in this case only you dont use $_get in-favor for $_SERVER['REQUEST_URI']? Is it for some fuelphp reason?

    RewriteRule ^(.*)$ index.php/$1 [L] - usualy GET case
    RewriteRule ^(.*)$ index.php?/$1 [L] - Server Request uri case
  • Sorry? Not sure what you mean.

    The default rewrite we include is:

        # deal with php5-cgi first
        <IfModule mod_fcgid.c>
            RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
        </IfModule>

        <IfModule !mod_fcgid.c>

            # for normal Apache installations
            <IfModule mod_php5.c>
                RewriteRule ^(.*)$ index.php/$1 [L]
            </IfModule>

            # for Apache FGCI installations
            <IfModule !mod_php5.c>
                RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
            </IfModule>

        </IfModule>

    Which means we do use what you call "GET case"?
  • What i meant:
    Why does the default rewrite rule, in example below commented out, doesn't have "?" in it, all other rewrite rules which you listed in the comment above has "?", why is it so?

     # for normal Apache installations
    <IfModule mod_php5.c>
          # RewriteRule ^(.*)$ index.php/$1 [L]
          RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>

    We modify this .htaaccess line (old a.k.a default line is commented out). 
  • HarroHarro
    Accepted Answer
    Because it's the other way around.

    FuelPHP works with URI segments, which is what the original rule creates (the one you commented).

    This however doesn't work with the CGI binary, so there we use the workaround of creating a fake query string (it's not a valid one, since it does not contain var=value pairs, and it could contain another question mark with a valid query string), and in the code use the REQUEST_URI to access the raw request, and reconstruct everything again.

    Reconstructing takes a lot more code and validation, so it should be used as a last resort, not by default.
  • Thanks for the answers, well we used $_GET variable later in code the get the first part of the url as language code, but as we foudn out the $_GET parameter in this case doesnt contain the url. So we just switched $_GET for Input::uri() :)

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion