0

ルートのサブフォルダーに codeigniter をインストールしています。アプリケーションにアクセスするための現在の URL は次のようになります。

http://www.site.com/subfolder/index.php/controller/action

index.phpURLから削除したいので、.htaccessファイルを作成しました。ファイルは次のようになります。

Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteBase /subfolder
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

そして私も編集しました

$config['index_page'] = 'index.php'; 

に:

$config['index_page'] = '';

と:

$config['uri_protocol'] = 'root';

に:

$config['uri_protocol'] = 'REQUEST_URI';

次に、URLを試しました:

www.site.com/subfolder/controller/action

しかし、Not foundエラーページが表示されます.URLを次のように編集すると、ページが機能するようになりました。

www.site.com/subfolder/?/controller/action
4

1 に答える 1

0

このように .htaccess を変更してみてください

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /subfolder/index.php/$1 [L]
于 2013-08-31T08:40:46.720 に答える