たとえば、「www.url.com/controller/function」にルーティングする必要があります。ルートの「config.php」にコードを入れましたが、機能しません。URLに「index.php」を入れずに、同じコントローラーのビューにロードする必要があります。可能です?
2 に答える
これは、url から index.php を削除するのに役立つ URL です。
URL から index.php を削除するには、 .htaccessファイルを使用する必要があります。
それが役に立てば幸い
更新しました
application\config\config.php ファイルを見てください。'index_page' という名前の変数があります。
このように見えるはずです
$config['index_page'] = "index.php";
に変更します
$config['index_page'] = "";
これは、これを使用できる .htaccess ファイルです。
RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
ここに完全なリンクを使用するものがあります..これらをたどることができます..
index.php を削除する stackoverflow index.php
を削除する codeigniter フォーラム
サーバーから mod の書き換えを有効にする
これらがあなたを助けることを願っています
By default, the index.php file will be included in your URLs:
www.url.com/index.php/controller/function
You can easily remove this file by using a .htaccess file with some simple rules. Here is an example of such a file, using the "negative" method in which everything is redirected except the specified items:
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]
Put the .htaccess file containing the above code to your app root folder.