开发者

.htaccess grab whole path

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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜