php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23901 PHP/Apache Fails to process scripts that use "Clean URLs"
Submitted: 2003-05-30 10:38 UTC Modified: 2003-05-30 11:28 UTC
From: tdrake at tymail dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 4.3.2 OS: Redhat Linux 9
Private report: No CVE-ID: None
 [2003-05-30 10:38 UTC] tdrake at tymail dot com
I'm not really sure if this is a problem with php or with apache2, but here goes.

I use a technique called "Clean URLs" to make better use of get variables.  The idea behind it is to allow both simplification and obfusication of URLs when working with GET variables.

An example of a "Clean URL" would be:
http://servername/index.php/foo/bar

Instead of:
http://servername/index.php?var1=foo&var2=bar

This technique has worked fine for me in the past, but has since stopped working after upgrading to Apache 2 and PHP 4.3.2.  I now get an apache 404 error when the extra /'s are added to the url line.

The following script works when using apache 1.x but not 2.x.

<?
$url = explode("/", $PHP_SELF);
$getvars=array();
while (list($key, $value) = each($url)) {
    if (ereg("=", $value)) {
        list($var_name, $val) = explode("=",$value);
        $getvars[$var_name]   = urldecode($val);
    }
    else {
        $getvars[$var_name] = $urldecode[$value];
    }

}

$sysvars->HTTP_POST_VARS   = $HTTP_POST_VARS;
$sysvars->HTTP_GET_VARS    = $getvars+$HTTP_GET_VARS;
$sysvars->HTTP_COOKIE_VARS = $HTTP_COOKIE_VARS;

// This should print the variables that were encoded in the URL.
print_r($sysvars->HTTP_GET_VARS);

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-30 10:56 UTC] ted at suteki dot org
You can find a working example of this at: http://www.suteki.org
 [2003-05-30 11:28 UTC] sniper@php.net
This has absolutely nothing to do with PHP.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 20:01:28 2024 UTC