从Fedora 16服务器中php CodeIgniter的URL中删除Index.php
如果URL中没有index.php,我的web应用程序将无法工作。它一直在我以前的笔记本电脑(OS:Ubuntu 10.10)中工作。在我的新笔记本电脑OS Fedora 16中,它无法工作。我做了所有的检查,比如.htaccess、cofig.php等。其他应用程序,而不是像PHPMyAdmin这样的CodeIgniter框架,工作得很好。下面是我的.htaccess代码从Fedora 16服务器中php CodeIgniter的URL中删除Index.php,php,codeigniter,fedora16,Php,Codeigniter,Fedora16,如果URL中没有index.php,我的web应用程序将无法工作。它一直在我以前的笔记本电脑(OS:Ubuntu 10.10)中工作。在我的新笔记本电脑OS Fedora 16中,它无法工作。我做了所有的检查,比如.htaccess、cofig.php等。其他应用程序,而不是像PHPMyAdmin这样的CodeIgniter框架,工作得很好。下面是我的.htaccess代码 # Options Options -Multiviews Options +FollowSymLinks #
# 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中,我有以下配置
$config['index_page'] = "";
$config['REQUEST_URI'] = "AUTO";
请告诉我解决问题的方法。请在appache配置文件中检查mod_rewrite module是否启用 您可以通过以下命令进行检查
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>
#自定义错误消息。
ErrorDocument 404/index.php
#设置默认处理程序。
DirectoryIndex.php
#各种重写规则。
重新启动发动机
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L,QSA]
它已启用。在phpinfo()中,mod_rewrite显示在apache2handler配置下加载的模块中。还有什么想法吗?首先请试用这个最小的代码并检查一下。这对我来说很好:#自定义错误消息。ErrorDocument 404/index.php#设置默认处理程序。DirectoryIndex.php#各种重写规则。RewriteCond%{REQUEST_FILENAME}上的RewriteEngine-f RewriteCond%{REQUEST_FILENAME}-重写规则^(.*)$index.php?/$1[L,QSA]为什么要对同一个问题发布两个答案?在删除其中的所有代码后,我将其放入.htaccess文件中。但它仍然不起作用。无论如何,非常感谢你的回复。