codeigniter htaccess需要帮助

时间:2013-06-19 12:31:43

标签: codeigniter .htaccess

My Site:

为什么我的.htaccess文件无效。我的框架是CodeIgniter

Options -Indexes
Options +FollowSymLinks
RewriteEngine On
RewriteBase http://core01.0fees.net/exam/

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]

#When your application folder isn't in the system folder

RewriteCond %{REQUEST_URI} ^application.*
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
RewriteRule ^(.*)$ index.php?/$1 [L]
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin   

ErrorDocument 404 /index.php

3 个答案:

答案 0 :(得分:1)

尝试更改此行:

RewriteBase http://core01.0fees.net/exam/

对此:

RewriteBase / exam /

RewriteBase选项使用来自web root的相对路径。

答案 1 :(得分:0)

尝试这个我使用它对我来说很好。   asset是我的应用程序文件夹的名称,您可以将其更改为您自己的文件夹。

RewriteEngine on
RewriteCond $1 !^(index\.php|uploads|images|css|js|lib|img|bootstrap|favicon|robots\.txt)
RewriteRule ^(.*)$ /asset/index.php/$1 [L]

答案 2 :(得分:0)

如果您正在使用linux环境,请尝试小写第一个字母(home / home.php) linux环境区分大小写Hom​​e.php和home.php在linux中不一样。你的问题很可能是这个