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[]
Edit:
My .htAccess look like:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ index.php [NC,L]
Everything that doesn't exist go to index.php. Since I already use this structure : /index.php?page=45&info=whatever&anotherparam=2
nothing is broken. But now I will use /profile/whatever/2
and in the switch case I can determine what page to include(..)
but the problem is with all GET parameters. How do I build them to have access from all page with $_GET[]?