0

codeigniter ユーザーガイドを確認しましたが、問題を解決できませんでした。

ローカルホストに Web ページを作成しました。

行ったらhttp://localhost/webpage/大丈夫です。デフォルトのコントローラーに移動します。

私のデフォルトのコントローラーはで、 という名前のHomepageメソッドがあります。indexguaranteeabout

routes.php に移動すると、これを追加しました。

$route['guarantee'] = "homepage/guarantee";
$route['about_us'] = "homepage/about";

次にアクセスしようとするとhttp://localhost/webpage/guaranteehttp://localhost/webpage/about_usエラー 404 が表示されます。

でもこうやってみる$route['default_controller'] = "homepage/guarantee";と保証ページが表示されます。

誰でもこの問題で私を助けることができますか? ありがとう。

4

2 に答える 2

1

あなたの中で、空のよう application/config/config.phpに設定するとうまくいくはずです。$config['index_page']$config['index_page'] = '';

于 2012-06-04T16:14:37.713 に答える
1

index.php を削除する必要があります。application/config.php ファイルの変更で

$config['index_page'] = 'index.php';

$config['index_page'] = '';

次に、この .htaccess ファイルをルート フォルダー (index.php と同じフォルダー内) に配置します。

Options -Indexes
Options +FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>

    # Activate URL rewriting:
RewriteEngine on

# do not rewrite links to the documentation, assets and public files
RewriteCond $1 !^(uploads|assets|js|css|images|img)


    # but rewrite everything else
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    ErrorDocument 404 index.php
</IfModule>  
于 2012-06-04T16:15:30.397 に答える