2011-02-11 37 views
0

我建立使用CI一個網站,我想我的網站URI是乾淨的CI 2.0控制器/功能接入不工作

http://myweb.com/controller/function 

不「的index.php」的一部分。

我與CI 1.73這樣做成功,但我可以讓它與CI 2.0
工作不是我訂route.php是:

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

和config.php文件

$config['index_page'] = ''; 

我也已經把這是用我的審判工作.htaccess文件CI 1.73

<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> 

有什麼建議嗎?

+0

記得說出你正在嘗試什麼,究竟發生了什麼,而不僅僅是「不工作」。 – 2011-02-11 12:10:06

回答

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]