0

CI を使用して Web サイトを構築しており、Web サイトの URI を次のようにきれいにしたい

http://myweb.com/controller/function

「index.php」部分なし。

CI 1.73でこれを行うことに成功しましたが、CI 2.0で動作させることができません
。route.phpを次のように設定しました:

$route['default_controller'] = 'home';

およびconfig.php

$config['index_page'] = '';

また、CI 1.73 を使用してトライアルで動作していた .htaccess ファイルを配置しました

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /myweb

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

なにか提案を ?

4

1 に答える 1

2

RewriteBase /mywebこの行が犯人だと思います。RewriteBase /代わりに入れてみてください。

また、次のように、動作するまで .htaccess を最大限に簡素化してみます。

<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

/そうではなく、index.phpの後に置くべきだと思うことに注意してください?/

RewriteRule ^(.*)$ index.php/$1 [L]
于 2011-02-11T09:16:30.727 に答える