These forums are read-only and for archival purposes only!
Please join our new forums at
$_GET empty
  • I rewrite the URLs with a rewrite rule like this:

    RewriteRule ^(.*)$ /index.php?/$1 [L]

    It works fine but with this rule, I can't submit GET values to the script. $_GET is empty. If I change the rewrite rule to this:

    RewriteRule ^(.*)$ /index.php/$1 [L]

    it works fine on my locale test server with Apache 2.x, but on my real server with Apache 1.3.x I get the error:

    No input file specified.

    What can I do?
  • Try removing the first slash.
  • This has no effect.
  • To explain what's happening here, assume you have this rewrite rule:

    RewriteRule (.*) index.php?$1 [L]

    Now, assume you go to The rewritten URL is Using ?$1 routing replaces $_GET with the URI, which prevents it from being used for anything else. It is only recommended to use ?$1 routing when you *want* to disable $_GET.

  • Okay. :( How about using the following?

    # Enable rewriting
    RewriteEngine on
    # Installation directory
    RewriteBase /
    # Allow these directories and files to be displayed directly:
    # - index.php (DO NOT FORGET THIS!)
    # - robots.txt
    # - favicon.ico
    # - Any file inside of the media/ directory
    # - WordPress content/ directory
    RewriteRule ^(index\.php|robots\.txt|favicon\.ico|media) - [PT,L]
    # Protect application and system files from being viewed
    RewriteRule ^(application|modules|system) - [F,L]
    # Rewrite all other URLs to index.php/URL
    RewriteRule .* index.php/$0 [PT,L]

    It's a stripped version of the Kohana website's .htaccess.

  • It is only recommended to use ?$1 routing when you want to disable $_GET.

    And what can I do to enable $_GET on my Apache 1.3.x server?
  • Okay. :( How about using the following?

    Works fine on my locale Apache 2 but on my Apache 1.3.x I get the same error:

    No input file specified.

  • Is your Apache 1.3.x server running PHP5?

  • Yes, PHP 5.2.5
  • This is from CI, but this is really a mod_rewrite / PHP-as-CGI issue: no input file specified.

  • You are right that is is mainly an PHP/Apache issue but it could solved with a modification of the core Router.php

    After this code in line 207 (kohana 2.1.2):

    elseif (count($_GET) === 1 AND current($_GET) == '' AND substr($_SERVER['QUERY_STRING'], -1) !== '=')


    I add this additional elseif:

    elseif (count($_GET) > 1 AND current($_GET) == '')
    self::$current_uri = key($_GET);

    // Fixes really strange handling of a suffix in a GET string
    if ($suffix = Config::item('core.url_suffix') AND substr(self::$current_uri, -(strlen($suffix))) === '_'.substr($suffix, 1))
    self::$current_uri = substr(self::$current_uri, 0, -(strlen($suffix)));


    This is the rewrite rule:

    RewriteRule ^$ index.php [PT,L,QSA]
    RewriteRule .* index.php?/$0 [PT,L,QSA]

    Now it works fine on both servers and $_GET is available.
  • I had the same issue.

    Solved replacing this:
    RewriteRule .* index.php/$0 [PT,L]

    for this:
    RewriteRule .* index.php?$0 [PT,L]

Howdy, Stranger!

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

In this Discussion