2012-04-20 30 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