|
Posted by Andy Jeffries on 03/06/06 10:55
On Sat, 04 Mar 2006 15:03:56 -0800, Laeronai wrote:
> I'm making a blog cms and have been having trouble with making the URLs
> look good. Each post goes to a URL like "viewpost.php?id=40" but I want
> the URL to look like "YYYY/MM/TITLE" so it would come out to be
> "/2006/03/hey-look-its-march." Does anyone know how to do this in PHP?
As another example you could put the following at the top of your
viewpost.php script:
<?php
list($ignore, $year, $month, $title) = explode($_SERVER["PATH_INFO"]);
?>
And link to:
/viewpost.php/2006/03/hey-look-its-march
The server will use viewpost.php as the script and put anything after the
script name that looks like a path into $_SERVER["PATH_INFO"].
Cheers,
Andy
--
Andy Jeffries | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
Navigation:
[Reply to this message]
|