2013-12-11 58 views
3

我想从url中删除index.php。但它不工作!codeignitor:删除index.php不工作

使用Ubuntu 12.04(LAMP)。

CodeIgniter_2.1.2

.htaccess文件

<IfModule mod_rewrite.c> 
     RewriteEngine On 
     RewriteBase /cms1 



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

在config.php:

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

目录结构:

/var/www/cms1 

->cms1 
    ->application 
    ->system 
    ->user_guide 
    ->index.php 
    ->license.txt 
    ->.htaccess 

回答

2

的.htaccess:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php/$0 [PT,L] 

而在你的应用程序/配置/ config.php文件

$config['base_url'] = 'http://www.yourwebsite.com'; //url to your project 
$config['index_page'] = ''; //Needs to be empty