View Single Post

  #3 (permalink)  
Old 03-07-2008
Toby A Inkster
 
Posts: n/a
Default Re: "Nice URLs" - how to implement it in PHP?

WebCM wrote:

> 1. Should we use nice urls for every page?


"Nice things are nicer than nasty ones."
-- _Lucky Jim_, Kingsley Amis.

> 2. Do we need to put a FULL path into <a href="">?


I tend to use a root-relative path (i.e. one starting with "/").

> 3. What is faster and better?
>
> a) 10 rules in .htaccess which redirect you to normal URLs with GET
> parameters
> b) one rule in .htaccess and parsing "nice url" in PHP (strpos,
> explode...).


Which is faster? Probably not much difference. mod_rewrite rules in
httpd.conf will beat both though.

I tend to just redirect all requests (except a few specific directories
for CSS files, images, downloads, etc) to "index.php/*" and then PHP logic
can deal with them.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 37 days, 18:16.]
[Now Playing: Ed Harcourt - The Trapdoor]

Bottled Water
http://tobyinkster.co.uk/blog/2008/02/18/bottled-water/
Reply With Quote