Re: strange php url
| From: | tg-php at gryffyndevelopment dot com | Date: | Fri, 21 Apr 2006 18:11:53 +0000 |
| Subject: | Re: strange php url | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-234503@lists.php.net to get a copy of this message | ||
You could do that... a "poor man's mod_rewrite" might involve something like this and
making the main PHP parsing script your 404 page.. so no matter where you went on a page, the 404
redirect to your PHP script would parse the request (or would you get the post-redirected URL? in
which case you'd have to get the 'referrer' maybe? not sure..).
Sounds like it could have some security issues though..giving too much power to the user and what
they enter in the URL being used as variable data.. definitely would want to scrub that input
hard.
-TG
= = = Original message = = =
I believe Kevin is on the right track there. To expand a bit, you can use
$_SERVER['PATH_INFO'] with these urls instead of $_GET to make use of the
data it contains
example for url http://www.example.com/index.php/foo/bar
<?php
echo $_SERVER['PATH_INFO'];
?>
produces:
/foo/bar
You can then parse this string, (generally by using the '/' character as a
deliminator) and extract the data. MediaWiki even provides information
(can't think of where at the moment) on how to use Apache's mod_rewrite to
hide index.php thus making the url even cleaner:
http://www.example.com/foo/bar
Cheers!
- Joe
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.