在 ubantu14.04 的 codeigniter-3 中从 url 中删除 index.php

Remove index.php from url in codeigniter-3 in ubantu14.04

我有 Ubantu 14.04 机器我也检查过 Link

我的 phpinfo() 说 rewrite_module 已启用 我也已将 config.php

更改为

$config['index_page'] = '';

下面是我在根目录下的 .htaccess 文件

RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/ [L]

试试这个

Options +FollowSymLinks
IndexIgnore */*
# Turn on the RewriteEngine
RewriteEngine On
#  Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

我刚刚添加了解决方案

<Directory /var/www/html >
   Order allow,deny
   AllowOverride All
   Allow from all
   Require all granted 
 </Directory> 

进入文件 /etc/apache2/sites-available/000-default.conf 并且工作正常