从 Fedora 16 服务器中 PHP CodeIgniter 中的 URL 中删除 Index.php



我的 Web 应用程序在没有 URL 中的索引.php的情况下无法工作。它一直在我以前的笔记本电脑(操作系统:Ubuntu 10.10)中工作。在我的新笔记本电脑中,在OS Fedora 16中它不起作用。我做了所有的检查,如.htaccess,cofig.php等。其他应用程序而不是像PHPMyAdmin这样的CodeIgniter框架,工作正常。以下是我的.htaccess代码。

# Options
  Options -Multiviews
  Options +FollowSymLinks
 #Enable mod rewrite
 RewriteEngine On
 #the location of the root of your site
#if writing for subdirectories, you would enter /subdirectory
RewriteBase /barj
#Removes access to CodeIgniter 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]
#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 %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css
#folders, and the robots.txt file
RewriteCond $1 !^(index.php|images|robots.txt|css)
RewriteRule ^(.*)$ index.php?/$1 [L]

在配置.php中,我有以下conf

$config['index_page'] = "";
$config['REQUEST_URI']  = "AUTO";

请给我解决问题的任何想法。

请检查 appache 配置文件mod_rewrite模块是否已启用。

您可以通过以下命令进行检查。

echo phpinfo();

如果未启用,请启用它。

首先尝试这个最小的代码。它对我来说工作正常。

# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

最新更新