Re: Replacing ? and & with / in URLS

From: Date: Wed, 06 Dec 2000 19:50:48 +0000
Subject: Re: Replacing ? and & with / in URLS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-28963@lists.php.net to get a copy of this message
I used this quite some time ago with CGI PHP, and it worked. Actually, you don't have to use mod_rewrite to achieve this. ForceType is enough, since Apache uses the longest part of a URL that maps to a file on the underlying filesystem. E. g.: say you have the DocumentRoot in /www, and you have a PHP script named "script" in /www/foo/bar, you can put (this is just one of several possible ways) <Location /foo/bar/script> ForceType application/x-httpd-php </Location> in your httpd.conf. Then, when Apache recieves a URL like http://www.server.tld/foo/bar/script/var1/somevalue/var2/othervalue it invokes /www/foo/bar/script, and you can then extract the variables from $HTTP_SERVER_VARS["QUERY_STRING"] (assuming there is "S" somewhere in the value of the variables_order directive, either in php.ini or in httpd.conf, but that's another story). Let me try... Well, it apparently doesn't work anymore. http://www.server.tld/foo/bar/script serves the script fine, however when I add something to the URI, I get an empty file, and "GET /foo/bar/script/var1/somevalue/var2/othervalue HTTP/1.1" 200 5 in the Apache access log... I don't know the internals, but this looks like a bug somewhere... Ok, this is really interesting. I'm trying something like http://www.server.tld/foo/bar/script. With the <Files ...> directive, Apache outputs the file without handing it over to PHP to parse it. access log: 200 76 (correct length) With <Directory ...> I get an empty file. access log: 200 5 With <Location ...> tried again I get an empty file! access log: 200 5 This is really weird, since the last method worked when i tried it about ten minutes ago... However, I'm not sure who's to blame, since I use DSO PHP 4.0.4-dev and Apache 1.3.15-dev on NT5 SP1. I'm going to try newest Apache and PHP, and if that doesn't help, latest Apache and PHP releases. Nevertheless, this thing worked for me at least with Apache 1.3.12 and one of PHP 4.0 betas... At 05:47 6.12. 2000, Richard Lynch wrote the following: -------------------------------------------------------------- >It involves the Rewrite rule/module to Apache (http://apache.org) and then >PHP uses $argc/$argv or $PATH_INFO to figure out the args. > >I don't see why it wouldn't work with CGI, but never tried it. > >Zeev (?) has a tutorial out there somewhere about it, but I dunno if that's >the one you're referencing or not... On Devshed or Weberdev or PHPBuilder >maybe? > >----- Original Message ----- >From: "Nold, Mark" <Mark.Nold@normandy.com.au> >Newsgroups: php.general >Sent: Tuesday, December 05, 2000 10:18 PM >Subject: [PHP] Replacing ? and & with / in URLS > > >> -------------------------------------------------------------------------- >-- >> ----------------- >> Disclaimer: The information contained in this email is intended only for >the >> use of the person(s) to whom it is addressed and may be confidential or >> contain legally privileged information. If you are not the intended >> recipient you are hereby notified that any perusal, use, distribution, >> copying or disclosure is strictly prohibited. If you have received this >> email in error please immediately advise us by return email at >> postmaster@normandy.com.au and delete the email document without making a >> copy. >> -------------------------------------------------------------------------- >-- >> ----------------- >> Hi, >> >> Ive seen several references to the fact that you can exchange ? and & in >> URLS (ie: GET) with / >> >> >> http://www.yourserver.com/db/script.php3?radius=3&user=6&people=TRUE >> will become this: >> >> http://www.yourserver.com/db/script.php3/radius/3/user/6/people/TRUE >> >> (These are from >> >> http://marc.theaimsgroup.com/?l=php-general&m=94961873902307&w=2 >> ) >> >> >> I'm having problems with this on Apache with PHP as a CGI, where i get an >> Internal Server error all the time. Any ideas? >> >> Any idea what this functionaly is called? Is it a PHP function? an Apache >> function? >> >> Thanks, >> >> mn >> >> >> Mark Nold >> markn@enspace.com >> Senior Consultant >> >> Change is inevitable, except from vending machines. >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >> For additional commands, e-mail: php-general-help@lists.php.net >> To contact the list administrators, e-mail: php-list-admin@lists.php.net >> > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net ------end of quote------ ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz ICQ: 2808 2505

« previous php.general (#28963) next »