[英]Apache error 404 for subdomain with Codeigniter application
我正在尝试访问此网站中的子域网址
http://medica.mastertools.net/
但我总是得到:
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
我发现这不是服务器配置,因为指向另一个文件夹,子域有效,因此Codeigniter中的某些内容可能是错误的。
在route.php中,我有:
$route['default_controller'] = "home";
$route['logincheck'] = "home/logincheck";
和我的控制器:
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();
}
}
为了使框架能够处理URL路径,必须做好两件事:
如何启用mod_rewrite: 如何为Apache 2.2启用mod_rewrite
重写规则: Apache重写规则
有关更多信息,请阅读Apache HTTP文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.