![](/img/trans.png)
[英]Redirecting to another page in online getting 404 not found error in codeigniter
[英]Codeigniter on OpenShift is redirecting to 404 error page
我最近在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跟踪的路线? 你们有什么线索吗?
用这个。
在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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.