2012-04-20 27 views
0

我加为了消除在index.php下面我笨项目到我的.htaccess:笨+ FB PHP SDK +国防部重写删除的index.php =灾难

#Removes access to the system folder by users. 
#Additionally this will allow you to create a System.php controller, 
#previously this would not have been possible. 
#'system' can be replaced if you have renamed your system folder. 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

#When your application folder isn't in the system folder 
#This snippet prevents user access to the application folder 
#Submitted by: Fabdrol 
#Rename 'application' to your applications folder name. 
RewriteCond %{REQUEST_URI} ^application.* 
RewriteRule ^(.*)$ /index.php?/$1 [L] 

#Checks to see if the user is attempting to access a valid file, 
#such as an image or css document, if this isn't true it sends the 
#request to index.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 

,一切运行良好。我的网址不再需要index.php了。

然而,这创造了一个有趣的副作用,例如,当我尝试使用Facebook的OAuth的登录,我收到以下错误:

The webpage at =">https://www.facebook.com/dialog/oauth?client_id=123&redirect_uri=http%3A%2F%2Fwww.domain.com%2Fsign_in%2Ffacebook%2F&state=8f3d1e5de60e47935460564a41f35af3&scope=email#= has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

注:客户端ID和重定向URI已更改隐私。

我正在使用PHP SDK 3.1.1 https://github.com/facebook/php-sdk并遵循http://developers.facebook.com/blog/post/503/上的示例代码。当我的网址仍然有index.php时,一切正常。在添加重写规则以删除index.php后,问题似乎已经开始。

任何想法发生了什么以及如何解决这个问题?

回答

0

尝试下面的补丁: 在系统/核心/ config.php文件,在SITE_URL方法替换下面的行 返回$这 - > slash_item( 'BASE_URL')$这 - > slash_item( 'index_page')。 $本 - > _ uri_string($ URI)$后缀。 与新代码: 返回$这个 - > slash_item( 'BASE_URL')$这 - > _ uri_string($ URI)$后缀;。

它可能会工作...

+0

这是应该做什么?我不认为我想触摸核心。 – StackOverflowNewbie 2012-04-20 13:58:46