I'm having a trouble while I'm trying to read the full path of my website address, using .htaccess friendly URL. The point is this:
I have an htaccess, which has this:
RewriteRule ^(.*)$ index.php?loadpage=$1 [L]
What this code actually does, is when I enter to mywebiste.com/params, it's interpreted by htaccess as ?loadpage=params. If I have more params, it's gonna be read like this: ?loadpage=params/param1/1.
So: http://mywebsite.com/params/param1/1 = http://mywebsite.com/index.php?loadpage=params/param1/1.
The way I read these params, is using a simply explode:
$params = explode("/", $_GET['loadpage']);
So it's simply now, because I read it like this:
$params[0] = "params";
$params[1] = "param1";
$params[2] = "1";
I mean, if I want to catch some value from URL, i MUST KNOW where is it placed, because if not, the array will be empty.
Even at this point, I'm asking myself if this is actually correct. This isn't hard as it seems, it's easy to manage those arrays if you know its position everytime.
My big trouble comes when I need to work with many address, many parameters. It's hard to control them, because the difference between $GET and this kind of count that I'm having, is that I know the KEY and VALUE of GET. But in the way I'm using, I only get the VALUE, so I must calculate the key, assuming its position and some other vars.
Hope you guys help, I'm going crazy with this. Thanks.