OpenShift上的Codeigniter重定向到404错误页面

时间:2015-06-15 04:07:31

标签: php .htaccess codeigniter openshift

我最近在OpenShift上创建了一个帐户来托管我的一些应用程序并将它们发送给我的客户,这样他们就可以看到,测试并给我反馈。

我的第一个应用程序是我在计算机上的CodeIgniter项目。我创建了一个名为tester的默认控制器,并将其设置为routes.php

我像这样配置了我的.htaccess

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|styles)
RewriteCond $1 !\.(ico|js|css|jpg|png|gif|html|ico?g)$
RewriteRule ^(.*)$ index.php/$1 [L]

它在localhost上工作正常,但是当我尝试在OpenShift上看到我的网站时,它会一直重定向到404页面。

如何测试Codeigniter追踪的路线?你们中的任何人都知道发生了什么事吗?

1 个答案:

答案 0 :(得分:0)

使用它。

config.php

中的

$config['base_url'] = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '';

Config / routes.php

$route['default_controller'] = "main";//your controller name. ex: i used main
$route['404_override'] = '';
控制器文件夹

中的

  

档案名称= main.php

在main.php内

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller
{

    public function  __construct()
    {


    }
}
.htaccess (外侧应用程序文件夹)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L] 
</IfModule>
相关问题