"Error 404 Not Found" in Magento Admin Login Page

Error 404 Not Found in Magento Admin Login Page

Finally, I found the solution to my problem.

I looked into the Magento system log file (var/log/system.log). There I saw the exact error.

The error is as below:-

Recoverable Error: Argument 1 passed
to Mage_Core_Model_Store::setWebsite()
must be an instance of
Mage_Core_Model_Website, null given,
called in
YOUR_PATH\app\code\core\Mage\Core\Model\App.php
on line 555 and defined in
YOUR_PATH\app\code\core\Mage\Core\Model\Store.php
on line 285

Recoverable Error: Argument 1 passed
to
Mage_Core_Model_Store_Group::setWebsite()
must be an instance of
Mage_Core_Model_Website, null given,
called in
YOUR_PATH\app\code\core\Mage\Core\Model\App.php
on line 575 and defined in
YOUR_PATH\app\code\core\Mage\Core\Model\Store\Group.php
on line 227

Actually, I had this error before. But, error display message like Error: 404 Not Found was new to me.

The reason for this error is that store_id and website_id for admin should be set to 0 (zero). But, when you import database to new server, somehow these values are not set to 0.

Open PhpMyAdmin and run the following query in your database:-

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

I have written about this problem and solution over here:-

Magento: Solution to "Error: 404 Not Found" in Admin Login Page

Magento2 Admin 404

It's Hard to find why its happen without seeing your installation process.
But this may help you:

  1. You can reinstall your project
  2. By mistake you forget your admin URL; You can see/change admin URL from

    app/etc/env.php
    at line no 5.

    return array (
    'backend' =>
    array (
    'frontName' => 'admin_q76xvk',
    ),
  3. Clean cache/reindexing and delete var/cache , var/page_cache folder.

  4. Make change in .htaccess (Just copy this file pub/.htaccess to magento root folder)


Magento 404 on Admin Page

A no route 404 error usually indicates Magento can't find the controller file it thinks it should load (usually due to a misconfiguration)

The easiest way to diagnose this is to hop to _validateControllerClassName

#File: app/code/core/Mage/Core/Controller/Varien/Router/Standard.php
protected function _validateControllerClassName($realModule, $controller)
{
$controllerFileName = $this->getControllerFileName($realModule, $controller);

if (!$this->validateControllerFileName($controllerFileName)) {
return false;
}

$controllerClassName = $this->getControllerClassName($realModule, $controller);
if (!$controllerClassName) {
return false;
}

// include controller file if needed
if (!$this->_includeControllerClass($controllerFileName, $controllerClassName)) {
return false;
}

return $controllerClassName;
}

and drop some logging or var_dumps around the return false statments. This should tell you which files Magento is looking for and can't find — it's usually enough to point to the problem.

    if (!$this->validateControllerFileName($controllerFileName)) {  
var_dump($controllerFileName);
return false;
}

$controllerClassName = $this->getControllerClassName($realModule, $controller);
if (!$controllerClassName) {
var_dump($controllerClassName);
return false;
}

// include controller file if needed
if (!$this->_includeControllerClass($controllerFileName, $controllerClassName)) {
var_dump("Couldn't include: $controllerFileName");
return false;
}

Update: It's normal for Magento look for the controller file in multiple places — every module that registered as containing adminhtml controller files needs to be checked.

However, almost all the controller files being looked for are named /Controller.php. For the default /admin index page this should be IndexController.php. This makes me think your system thinks it's supposed to look for a controller with a blank name, (likely the default controller value since /admin (and not admin/index) is the URL you're using)

There's myriad reasons this could happen — many revolving around a core file being changed or a configuration node in a module set to the wrong value. If the solutions below don't work for you you'll need to try diff-ing your code base vs. a clean one, disabling every custom module and if that fixing things turn modules back on until the problem module is found, or dive deep into debugging Magento routing code to figure out why your system is unhappy.

One common cause for this behavior is an invalid value (or no value at all) being set for a custom admin path at

System -> Configuration -> Admin -> Admin Base URL -> Use Custom Admin Path

If the value for "custom admin path" is blank, or contains and additional /, this could be interfering with the routing.

Since you can't access the admin, try running the following SQL query

select * from core_config_data where path like '%custom_path%';    
...
292 default 0 admin/url/use_custom_path 1
293 default 0 admin/url/custom_path admin/

If you see results similar to the above, or admin/url/custom_path is blank/not-present but admin/url/use_custom_path is still 1 — then that's your problem.

Try deleting these configuration values (admin/url/use_custom_path) and (admin/url/use_custom_path) from core_config_data.

If that doesn't apply to your system, per my blank controller theroy my best guess would be for some unknown reason the code at

#File: app/code/core/Mage/Core/Controller/Varien/Router/Admin.php
public function fetchDefault()
{
// set defaults
$d = explode('/', $this->_getDefaultPath());
$this->getFront()->setDefault(array(
'module' => !empty($d[0]) ? $d[0] : '',
'controller' => !empty($d[1]) ? $d[1] : 'index',
'action' => !empty($d[2]) ? $d[2] : 'index'
));
}

is populating the controller key with a blank value.

Error 404: not found in magento frontend and also the admin

@HARDIKGOHIL : you can remove extension from your downloader link, if your backend is not working then also it downloader link will open and you have to login with same your backend username and password.

e.g yourdomain/downloader/

you will get list of modules of magento default as well as you have configured, un-install the module



Related Topics



Leave a reply



Submit