この投稿を開く前に、私はこれを理解しようと 3 日間費やしましたが、まったく運がなかったので、助けてください. ありがとう~~~~
わかりました、これは私がこれまでに行ったことです:
- CI 2.1.3 の新しいコピーをインストールします。どのフォルダーの名前も変更しません。
- Google で見つけたすべての構造を使用して、CI ROOT ディレクトリに新しい .htaccess ファイルを作成します。
- config['index_page'] を空に変更します。config['index_page'] ='';
- config['uri_protocol'] = 'REQUEST_URI' または 'QUERY_STRING' を設定</li>
- 上記の変更を行うたびに、MAMP(PHP 5.4)を再起動しても
- 有効: LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf
- https.conf に「Options Indexes FollowSymLinks MultiViews」を追加します (よくわからないことだけ)。
- (今何を試せばいいのかわからない V_V )
それから、私はこれを得ました:
はい動作: http://ci.dev/index.php/welcome/index
動作していません: http://ci.dev/welcome/index
ここに私が今持っているものの詳細があります:
.htaccess ファイル:
# I got 500 error if I uncommend this line: <IfModule mod_rewrite.c>
#http://ci.dev/index.php/welcome/index this is works fine only if the above line commend out
RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/?$1 [L]
# I got 500 error if I uncommend this line: </IfModule>
config.php
$config['index_page'] = '';
$config['uri_protocol'] = 'QUERY_STRING';
//$config['uri_protocol'] = 'REQUEST_URI';
ホストファイル
127.0.0.1 localhost
127.0.0.1 test.dev
127.0.0.1 ci.dev
httpd.conf ファイル
#the following line also enabled
LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf
...
# The following code I placed at the bottom of https.conf file
NameVirtualHost *
<VirtualHost *>
ServerName localhost
DocumentRoot "/Applications/MAMP/htdocs"
</VirtualHost>
<VirtualHost *>
ServerName ci.dev
DocumentRoot /Users/coda/Sites/ci
<Directory /Users/coda/Sites/ci>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *>
ServerName test.dev
DocumentRoot /Users/coda/Sites/test
</VirtualHost>
私を助けてください~~~~
ありがとう
================================================== ===============
ここで私を助けようとするすべての人に感謝します。ようやくうまくいきました。単純なことを見落とした後、どうにかして物事を複雑にしすぎたと思います。
CI2 の別のコピーをインストールし、.htaccess ファイルを次のように変更するだけです。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
その後、すべてがうまくいきます〜!!!! –</p>