26 posts
  • Sold between 10 000 and 50 000 dollars
  • Exclusive Author
  • Has been a member for 4-5 years
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
incrediblebytes says

Hi everyone :) Just wondering how is it better to implement pretty urls in PHP projects.

What would be optimal or best way to make a feature in a CMS so people can choose if they want to use pretty urls or not.

Shall I use a function for each URL ?

For example:

define("BASE_URL", "http://www.someproject.com/");
define("REWRITE", true);

# Array of url get params (parameter => value)
$postView = array(
    "post" => "some-post-title" 
);

echo url(BASE_URL, "view.php",  $postView, REWRITE);

And url() function will then build a url either like: http://www.someproject.com/view/post/some-post-title (if REWRITE is true) or http://www.someproject.com/view.php?post=some-post-title (if REWRITE is false)

Just interested what do you use? Maybe someone has got a lot of experience with this?

Thanks in advance :)

by
by
by
by
by
by