Tuesday, March 2, 2010

Programmer - Pretty URL to string parameters

Programmer Question

I have a website that use this style : /index.php?page=45&info=whatever&anotherparam=2



I plan to have pretty url to transform the previous url to : /profile/whatever/2



I know I have to use .htAccess and to redirect everything to index.php. That's fine.



My problem is more in the index.php (Front Controller). How can I build back the $_GET["info"] and $_GET["anotherparam"] to be able to continue to use all the existing code that use $_GET[...] in their page?



Do I have to build back the GET in the header with some code or do I have to get rid of all $_GET[...] on every pages by creating my own array that will parse ever / to and assign something like : $myParam["info"] = "whatever" and than in the page use $myParam[] instead of $_GET[] ?



I would like not to modify all those pages that use $_GET[]



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails