路由codeigniter不工作

时间:2015-08-19 12:12:04

标签: php codeigniter routes shared-hosting

我在codeigniter中的路由文件有问题。在Wamp上,我的路线正常运行。但是,在我的服务器(共享主机)上,我的路由不会运行。

我的主页位于fr文件夹中。我的控制器是索引。所以我的默认控制器是'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上,我的指令运行正常但不在我的服务器上。

有你的想法吗?

感谢您的回答。

2 个答案:

答案 0 :(得分:0)

您运行的是哪个版本的codeigniter? 如果您在v3中,请查看控制器和型号的文件名...如果这些文件的起始字母不是大写字母,则重命名 模型和控制器文件名的起始字母必须为大写

答案 1 :(得分:0)

好的,我有解决方案。这是htaccess和路由文件之间的问题。删除你的htaccess或编辑它。

相关问题