#23901 [Com]: PHP/Apache Fails to process scripts that use "Clean URLs"
| From: | ted at suteki dot org | Date: | Fri, 30 May 2003 15:56:11 +0000 |
| Subject: | #23901 [Com]: PHP/Apache Fails to process scripts that use "Clean URLs" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40726@lists.php.net to get a copy of this message | ||
ID: 23901
Comment by: ted at suteki dot org
Reported By: tdrake at tymail dot com
Status: Open
Bug Type: Apache2 related
Operating System: Redhat Linux 9
PHP Version: 4.3.2
New Comment:
You can find a working example of this at: http://www.suteki.org
Previous Comments:
------------------------------------------------------------------------
[2003-05-30 10:38:49] 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);
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23901&edit=1