i'm experimenting with a method for pretty urls i haven't tried before where htaccess just grans the whole path after the root and passes it as a single variable, then i will break it up into specific variables using php explode, but i'm getting stuck early on.
I'm using this line to grab everything in the url after "blah.com" -
RewriteRule ^(.*)$ index.php?url=$1 [NC]
then in php use this line to turn it into a variable
$url = $_GET['url'];
but when i test it with a fake path, like "blah.com/test/test2" $url echos as "index.php" instead of "test/test2"
i hate working with htaccess,开发者_运维百科 which is one of the reasons im trying this method, so i'm not sure what i need to do to fix this. any help would be... very helpful!
Don't bother with GET variables, just inspect $_SERVER['REQUEST_URI']
, infinitely simpler :)
精彩评论