RE: [PHP] User-friendly URI's
| From: | Opec Kemp | Date: | Fri, 04 Jan 2002 02:04:35 +0000 |
| Subject: | RE: [PHP] User-friendly URI's | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79423@lists.php.net to get a copy of this message | ||
You will need to use the following techniques:
* In Apache you will need to enable mod_rewrite module
http://httpd.apache.org/docs/mod/mod_rewrite.html
this allows you to "remap" URI to any script, in your case you'd probably
want and request to "/news" to be mapped to for example /news.php etc.
* In your script you will need to parse the URI via the "REQUEST_URI" server
variable.
Basically what you're doing in your apache is saying: "Pass all requests to
the URI to this instead" note that this will not affect the URL display in
your browser.
This is similar technique to making search engines index your site. I've
written replies to this subject a while back check it out here:
(Note that apparently my code in this post has some problem so..)
http://aspn.activestate.com/ASPN/Mail/Message/php-Users/373430
OR a better example here:
Building Dynamic Pages With Search Engines in Mind
http://www.phpbuilder.com/columns/tim19990117.php3
Revisited: Build Dynamic Pages With Search Engines in Mind
http://www.phpbuilder.com/columns/tim20000526.php3
HTH
> -----Original Message-----
> From: Mike Eheler [mailto:meheler@idearesource.com]
> Sent: Friday, 4 January 2002 10:01 AM
> To: php-general@lists.php.net
> Subject: [PHP] User-friendly URI's
>
>
> 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.