mod-rewrite和Facebook $ _ GET变量 [英] Mod Rewrite and Facebook $_GET variables

查看:138
本文介绍了mod-rewrite和Facebook $ _ GET变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在写我的登录系统,我授权与Facebook的用户,当遇到一个小问题...

While writing my login system, I came across a little issue when authorizing an user with Facebook...

在有人点击登录与Facebook按钮,体征/授权我的应用程序,Facebook的重定向回我的网站,推出了一系列的 $ _ GET 的变量,正常。唯一的问题是我想看看如果这些变量之一是为了检查Facebook登录的状态设置。

After someone clicks the 'Login with Facebook' button and signs in/authorizes my app, Facebook redirects back to my site, with a series of $_GET variables, as normal. The only issue is I'd like to check if one of those variables are set in order to check the status of the Facebook login.

当我尝试拉 $ _ GET 变种,它说,它不存在。这个问题是我使用mod_rewrite清理我的网址的apparence:

When I try pulling the $_GET var, it 'says' it doesn't exist. The issue is with my using mod_rewrite to clean up the apparence of my url:

#RewriteRule ^([A-Za-z0-9]+)/?$ ?a=b&content=$1 [L]
#RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/?$ ?a=b&content=$1&page=$2 [L]

这将打开:
www.mysite.com?content=login&page=2 进入
www.mysite.com /登录/ 2

所以,我的网址 www.mysite.com/content?state = [...]放; code = [...]放大器; ...等必须混淆Facebook的分配变量,与被重写 $ _ GET 瓦尔。

So my url of www.mysite.com/content?state=[...]&code=[...]&...etc must be confusing the variables Facebook assigns, with the to be rewritten $_GET vars.

同样的事情发生在一个url与的内容和页面设置。例如: www.mysite.com/content/page?state = ......

Same thing happens with a url with both the content and page set. eg: www.mysite.com/content/page?state=......

什么是解决这个的最好方法?我知道我能找到另一种方式来显示一个确认的Facebook登录,但是这仍将是一个问题,在今后的其他情况下,我敢肯定。

What would be the best way of solving this? I know I could find another way to show a confirmed Facebook login, but this will continue to be an issue for other situations in the future, I'm sure.

在此先感谢。

推荐答案

尝试使用 [L,QSA] ,而不是仅仅 [L]

Try using [L,QSA] instead of just [L].

这篇关于mod-rewrite和Facebook $ _ GET变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆