0

如果 URL 中没有 index.php,我的 Web 应用程序将无法工作。它一直在我以前的笔记本电脑(操作系统: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]

在 config.php 中,我有以下 conf

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

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

4

2 回答 2

1

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

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

echo phpinfo();

如果未启用,请启用它。

于 2012-06-02T06:38:59.113 回答
0

首先尝试这个最小的代码。它对我来说很好。

# 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>
于 2012-06-02T07:12:24.430 回答