-1

たとえば、「www.url.com/controller/function」にルーティングする必要があります。ルートの「config.php」にコードを入れましたが、機能しません。URLに「index.php」を入れずに、同じコントローラーのビューにロードする必要があります。可能です?

4

2 に答える 2

0

これは、url から index.php を削除するのに役立つ URL です。

ユーザーガイド 削除 index.php

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 の書き換えを有効にする

これらがあなたを助けることを願っています

于 2012-08-09T04:26:16.943 に答える
0

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.

于 2012-08-09T05:05:00.170 に答える