duancai7002 2017-11-23 17:42
浏览 41
已采纳

带有Codeigniter应用程序的子域的Apache错误404

I am trying to access subdomain url's in this web site

http://medica.mastertools.net/

but I always get:

The requested URL /logincheck was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Apache/2.4.29 (Win32) OpenSSL/1.0.2l PHP/7.1.11 Server at medica.mastertools.net Port 80

I found out is not a server configuration because pointing to another folder, subdomains work, so probably something in Codeigniter is wrong.

In the route.php I have:

$route['default_controller'] = "home";
$route['logincheck'] = "home/logincheck";

and my controller:

class Home extends CI_Controller {

public function __construct()
{
    parent::__construct();
}

function logincheck()
{
    if(isset($_POST['strUsername']))
    {
        $blogin_ok = $this->logmodel->check_login($_POST['strUsername'], $_POST['strPassword']);
        if( $blogin_ok == 1)
        {
            $this->index();
        }
        else if ( $blogin_ok == 2 )
        {
            $this->makeFinalLayout('loginchose');
        }
        else
        {
          $_SESSION['loggin_msg'] = LOGINERRORMSG;
            $this->login();
        }
    }
    else
    {
        $this->login();
    }
}
  • 写回答

1条回答 默认 最新

  • dpv50040 2017-11-23 18:54
    关注

    For frameworks to handle URL paths two things have to be in place:

    1. An .htaccess file with the appropriate rewrite rules or rewrite rules in the main apache configuration.
    2. Mod_rewrite has to be enabled.

    How to enable mod_rewrite: How to enable mod_rewrite for Apache 2.2

    Rewrite Rules: Apache rewrite rule

    For more information read the Apache HTTP Documentation

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化