2016-09-02 6 views
-1

CodeIgniterの私のアプリケーションのURLのindex.phpを非表示/削除する必要があります。私はYouTubeのチュートリアルで見たことがあるものの、うまくいきませんでした。ソリューションは私の.htaccessに何かを書いていました。ここでCodeIgniterのURLのindex.php文字列を取り出してください

は私のリポジトリです:

https://github.com/ashcrimson/CodeIgniter/tree/master/CodeIgniter

そして、ここにあなたが私の.htaccessファイルがあります。以下は

Options FollowSymLinks 
<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.")$ index.php?/$1 [L] 
</IfModule> 

<IfModule !mode_rewrite.c> 
    ErrorDocument 404 /index.php 
</IfModule> 

http://pastebin.com/eCU5UgL0

+0

'mod_rewrite'を有効にしましたか? – Blake

+0

はい、有効になっています。 –

+0

'RewriteBase'も追加してみてください。 'public_html' - >' RewriteBase/'のルート、またはいくつかのサブディレクトリ - >' RewriteBase/subdir /#は終了スラッシュを忘れないでください ' – Tpojka

答えて

0

をURLからindex.phpを取り出す私の.htaccessです。

DirectoryIndex index.php 
RewriteEngine on 
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA] 

のRewriteRule ^(.*)$ ./index.php/$1 [L,QSA]^(.*)$ない^(.")$

ルールを確認する必要があります。それが助けて欲しい。

^(.*)$ ./index.php/$1は、要求した内容を表しており、渡すパラメータを処理できるファイルindex.phpにリダイレクトします。

正規表現では、.は何でも意味します。 *は0回以上を意味します。

+0

これはそれでした。ありがとう! –

関連する問題