0

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();
    }
}
6
  • So the subdomain works but not /logincheck? Commented Nov 23, 2017 at 17:58
  • I found out now is not a server configuration because pointing to another folder subdomains work, so probably something in Codeigniter is wrong Commented Nov 23, 2017 at 18:00
  • only main domain works, /logincheck no Commented Nov 23, 2017 at 18:04
  • is there an .htaccesss file in the root directory of your website? Commented Nov 23, 2017 at 18:34
  • I suspect it is a couple of things. The .htaccess is not been read, and you have not enabled mod_rewrite, can you confirm you have an .htaccesss in the root directory? Commented Nov 23, 2017 at 18:36

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.