【发布时间】:2017-02-01 05:50:33
【问题描述】:
我想通过使用根目录中的.htaccess 文件来删除index.php。
我的框架是 codeigniter。
我的 htaccess :
AddType application/x-httpd-php53 php53 php
php_flag log_errors on
php_flag display_errors on
#php_value error_reporting 8
php_value error_reporting E_ALL
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^megarooz.com/$ [NC]
RewriteRule ^(.*)$ http://megarooz.com/$1 [R=301,L]
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
order allow,deny
allow from all
我的配置:
$config['base_url'] = 'http://megarooz.com';
$config['index_page'] = '';
我收到了这条消息:
Not Found
The requested document was not found on this server.
它不起作用:
http://megarooz.com/admin/Admin/login
效果很好:
【问题讨论】:
-
是否在 Apache 中安装并启用了 mod_rewrite?另外,尝试将
on更改为On -
@Magnus Eriksson 如何查看
mod_rewrite是否启用? -
您使用的是什么操作系统?顺便说一句,你在 PHP 5.3 上吗?你应该真的升级你的系统。 5.3 很久没支持了。甚至 5.6 也已结束主动支持。
-
我的php版本是
5.5.38
标签: php apache .htaccess codeigniter