CodeIgniter控制器未加载并出现404错误

时间:2013-11-26 14:12:39

标签: .htaccess codeigniter mod-rewrite http-status-code-404

我正在测试gocart(http://gocartdv.com/),我已将其安装在名为vine-cart的子文件夹http://www.icas-v.org/vine-cart中。

默认控制器加载正常,但其余控制器返回错误404消息。我已经查看了所有类似的问题和可能的解决方案,实施了它们,但它们似乎没有用。

请查看我的配置设置:

/ --------------------------------- | .htaccess文件设置| ---- ----------------------------- /

RewriteEngine On
RewriteBase /vine-cart

### Canonicalize codeigniter URLs

# If your default controller is something other than
# "welcome" you should probably change this
RewriteRule ^(cart(/index)?|index(\.php)?)/?$ / [L,R=301]
RewriteRule ^(.*)/index/?$ $1 [L,R=301]

# Removes trailing slashes (prevents SEO duplicate content issues)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [L,R=301]

###

# Removes access to the 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
RewriteRule ^(.*)$ index.php/$1 [L]

</IfModule>

<IfModule !mod_rewrite.c>

# Without mod_rewrite, route 404's to the front controller
ErrorDocument 404 /index.php

</IfModule>

/ --------------------------------- | Config.php settings | ---- ----------------------------- /

$config['base_url'] = 'http://www.icas-v.org/vine-cart/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';

/ --------------------------------- |路线文件设置| ----- ---------------------------- /

$route['default_controller']    = "cart";
//this for the admininstration console
$route['admin']                 = 'admin/dashboard';
$route['admin/media/(:any)']        = 'admin/media/$1';

我一直试图调试这几天。请帮忙。

1 个答案:

答案 0 :(得分:0)

你能试试这个htaccess代码吗?删除rewritebase。

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /vine-cart/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /vine-cart/ [L]
</IfModule>

您为控制器文件命名了什么?

如果你的.htaccess上的行被标记为1,如果它会导致问题,那么这是一个很好的做法。