路由编码器不工作


route codeigniter not working

我有一个问题与我的路由文件在codeigniter。在Wamp上,我的路由运行正常。但是,在我的服务器(共享主机)上,我的路由没有运行。

我的主页是在fr文件夹。我的控制器是Index。所以我的默认控制器是'fr/index'。

$route['default_controller'] = 'fr/index';
$route['404_override'] = ''; 

当我写www.domainName.tld,我得到"文件未找到"没有css样式。在源代码中我有

1文件未找到。
2

而当我写www.domainName.tld/aaaa(404错误),我有一个真正的404错误:

<!DOCTYPE html>
<html lang="en">
<head>
<title>404 Page Not Found</title>
<style type="text/css">
::selection{ background-color: #E13300; color: white; }
::moz-selection{ background-color: #E13300; color: white; }
::webkit-selection{ background-color: #E13300; color: white; }
body {
    background-color: #fff;
    margin: 40px;
    font: 13px/20px normal Helvetica, Arial, sans-serif;
    color: #4F5155;
}
a {
    color: #003399;
    background-color: transparent;
    font-weight: normal;
}
h1 {
    color: #444;
    background-color: transparent;
    border-bottom: 1px solid #D0D0D0;
    font-size: 19px;
    font-weight: normal;
    margin: 0 0 14px 0;
    padding: 14px 15px 10px 15px;
}
code {
    font-family: Consolas, Monaco, Courier New, Courier, monospace;
    font-size: 12px;
    background-color: #f9f9f9;
    border: 1px solid #D0D0D0;
    color: #002166;
    display: block;
    margin: 14px 0 14px 0;
    padding: 12px 10px 12px 10px;
}
#container {
    margin: 10px;
    border: 1px solid #D0D0D0;
    -webkit-box-shadow: 0 0 8px #D0D0D0;
}
p {
    margin: 12px 15px 12px 15px;
}
</style>
</head>
<body>
    <div id="container">
        <h1>404 Page Not Found</h1>
        <p>The page you requested was not found.</p>    </div>
</body>
</html>

我的。htaccess运行正常:

Options +FollowSymLinks
RewriteEngine on
#Sub-dir e.g: /cmsms
#RewriteBase /
#
# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !'.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# Empêche la visualisation de l’arborescence, n’a rien à voir avec le masquage du « index.php ». Options -Indexes 
# Active le module de réécriture d’URL. RewriteEngine on 
# Toutes les URL qui ne correspondent pas à ces masques sont réécrites.
RewriteCond $1 !^(index.php|assets/|robots.txt) 
# Toutes les autres URL vont être redirigées vers le fichier index.php. 
RewriteRule ^(.*)$ index.php/$1 [L]

我认为是主机问题,因为在wamp上,我的指令可以正常运行,但在我的服务器上却不能。

你有什么主意吗?

谢谢你的回答

您使用的是哪个版本的codeigniter ?如果你是v3版本,那么检查你的控制器和模型的文件名…如果这些文件的起始字母不是大写字母,那么重命名它模型和控制器文件名的起始字母必须为大写

好了,我有解决方案了。这是htaccess和路由文件之间的问题。