Re: User-friendly URI's

From: Date: Fri, 04 Jan 2002 01:06:26 +0000
Subject: Re: User-friendly URI's
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-79419@lists.php.net to get a copy of this message
It's actually alot easier that you think! for the news file, just create a file called 'news' (minus ' of course! ;) in your http root, then create (or append) a .htaccess with the following lines: <Files news>
    ForceType application/x-httpd-php
</Files> That tells Apache to parse news via PHP. As what you've passed (ie /2002/01/02/keyword) is not a query string, you won't find it in $_SERVER{'QUERY_STRING'}. Instead, its put into $_SERVER{'PATH_INFO'}. It's then up to you to do what you want with it! :) Works for me! :) Hope that helps! :) At 16:00 03.01.2002 -0800, Mike Eheler wrote:
http://www.somesite.com/news/2002/01/02/keyword I've seen some sites do this with other scripting languages (maybe even PHP.. I just don't know).. I like the look of this *way* better. Anyone have any insight as to how I can make that work with an Apache 1.3.xx + PHP 4.1.x setup? "news" would actually be a PHP script, of course. I know how to handle /2002/01/02/keyword as parameters, my question is on making "news" be interpreted through PHP. Mike -- 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
// Jonathan Wright // j.d.e.wright@cs.cf.ac.uk // GCS d- s: a-- C++(+) US> P+++ L+> E> W+++ !N w !O M- V- PS+@ PE+
//    Y PGP t+ !5 X R- tv(-) b(+) DI++++> D+(++) G h-- r-- z--(++)


« previous php.general (#79419) next »