如何阅读$ _GET变量(国防部重写供电)漂亮的网址

问题描述:

您好老乡程序员,

我用漂亮的URL中的第一次,我不能完全弄清楚为什么我无法从我的剧本读我的OAuth的响应。

I'm using nice URLs the first time and I can't quite find out why I can't read my oAuth responses from my script.

因此​​,这是我的设置:

So this is my setup:

的.htaccess

.htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

我有一个使用Google的OAuth的系统登录用户的脚本。这个脚本会将用户带到谷歌的API页面在这里他们可以让我的网站看他们的电子邮件地址,然后发送用户权限回到我的网站有很多的$ _GET变量。

I have a script that uses googles oAuth system to log in a user. This script sends the user to the google api page where they can allow my website to read their email adress and then send the user right back to my site with lots of $_GET variables.

我告诉谷歌将其发送到

http://mywebsite/login/google/response

和它的..

现在的问题是,谷歌将结果在这样的正常GET格式为:

The problem is that google sends the result in the normal GET format like this:

http://mywebsite/login/google/response/?openid.ns=http%3A%2F%2Fspecs.openid.ne[..]

和我的脚本无法读取。

有没有办法读取$ _GET变量时,他们用漂亮的网址混?

Is there any way to read $_GET variables when they mix with nice URLs?

您需要添加 QSA (查询字符串附加)为您的标志。

You need to add QSA (query string append) to your flags.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,PT,L]

那么你的 $ _ GET 将包含正确的值。