ステップ:-1フォルダー「application/config」を開き、ファイル「config.php」を開きます。config.php ファイルで以下のコードを見つけて置き換えます。
//find the below code
$config['index_page'] = "index.php"
//replace with the below code
$config['index_page'] = ""
ステップ:-2 CodeIgniter フォルダーに移動し、.htaccess を作成します。
Path:
Your_website_folder/
application/
assets/
system/
.htaccess <——— this file
index.php
Step:-3以下のコードを .htaccess ファイルに書く
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
ステップ:-4場合によっては、uri_protocol のデフォルト設定が正しく機能しません。この問題を解決するには、「application/config/config.php」ファイルを開いて、以下のコードを見つけて置き換えます
//Not needed for CodeIgniter 3 its already there.
//find the below code
$config['uri_protocol'] = "AUTO"
//replace with the below code
$config['uri_protocol'] = "REQUEST_URI"
それだけですが、wamp サーバーでは rewrite_module がデフォルトで無効になっているため機能しません。有効にする必要があります。このために、次のことを行います
- WAMPアイコンを左クリック
- アパッチ
- アパッチモジュール
- 左クリック rewrite_module
元のドキュメント
例のリンク