RE: [PHP-GENERAL] Variable URLS?

From: Date: Fri, 02 Jun 2000 15:51:17 +0000
Subject: RE: [PHP-GENERAL] Variable URLS?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-907@lists.php.net to get a copy of this message
At 04:32 PM 6/2/00 +0100, Liz Kimber wrote:
Sessions, then you dont see the variables at all, they are held behind the scenes. Then all you would see would be http://www.mydomain.com/ Liz
Hello All, Even with sessions, you would still have clients who would display a query string (http://www.mydomain.com/?SID=kj3a234sldi323...) Rasmus posted a cool solution to this type of problem some time ago - however, I am darned if I can remember where it is, so here is version of his solution. If you are running Apache, you can use a Location ( or Directory, or Files) directive combined with a ForceType directive to make URL based search queries. Basically, you add these line to your httpd.conf file or a .htaccess file. <Location /search> ForceType application/x-httpd-php3 </Location> Any requests made that start with /search will be send to a page called search. Any part of the url beyond the http://www.mydomain.com/search will be stored in the $PATH_INFO environment variable. You can use this information as the query terms for your search. ie. /* Remove the leading slash from $PATH_INFO and then convert the rest of $PATH_INFO into an array */ $terms = explode ('/', substr ($PATH_INFO, 1)); You are then left with an array that has all of the search terms that were specified in the URL. So a path of http://www.mydomain.com/search/chown/chmod/chgroup would translate to: array ('chown','chmod','chgroup'); HTH, Zak

« previous php.general (#907) next »