2.14.3.1.6. Admin panel refresh on login

OpenCart uses site URL binding, which can cause issues with logging in to site admin panel if address is incorrect. Problem manifests as follows: after entering login and password and clicking login button, page simply refreshes and login does not occur. Problem occurs if site is opened using www.example.com domain, while site address in configuration file is specified as example.com.

You can resolve the issue in one of the following ways:

  • Change site address to the one that will be used, or replace strings with it with the following:
    define('HTTP_SERVER', 'http://' . $_SERVER['SERVER_NAME'] . '/');
    define('HTTPS_SERVER', 'https://' . $_SERVER['SERVER_NAME'] . '/');

    ⚠️ Site address must match final address that results after all redirects configured in control panel (HTTP/HTTPS or www) and in .htaccess file.

  • Configure redirect. For situation with www or for other cases.
Contenido