0

index.phpを削除するために、CodeIgniterプロジェクトを.htaccessに追加しました。

#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]

すべてがうまくいきました。私のURLはもはやindex.phpを必要としません。

ただし、これにより興味深い副作用が発生し、Facebook OAuthを使用してログインしようとすると、次のエラーが発生します。

= ">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#=のWebページの 結果はリダイレクトが多すぎます。このサイトのCookieをクリアするか、サードパーティのCookieを許可すると、問題が解決する場合があります。そうでない場合は、サーバー構成の問題であり、コンピューターの問題ではない可能性があります。

注:プライバシーのために、クライアントIDとリダイレクトURIが変更されました。

PHP SDK 3.1.1 https://github.com/facebook/php-sdkを使用しており、 http://developers.facebook.com/blog/post/503/のサンプルコードに従いました。URLにindex.phpがまだ含まれている場合、すべてが正常に機能しました。index.phpを削除するための書き換えルールを追加した後、問題が発生したようです。

何が起こっているのか、これを修正する方法はありますか?

4

1 に答える 1

0

次のパッチを試してください:system / core / config.phpファイルで、site_urlメソッドで次の行を置き換えますreturn $ this-> slash_item('base_url')。$ this-> slash_item('index_page')。$ this-> _ uri_string ($ uri)。$ Supplements; 新しいコードの場合:return $ this-> slash_item('base_url')。$ this-> _ uri_string($ uri)。$ suffix;

動作する可能性があります...

于 2012-04-20T13:42:52.303 に答える