Magento – Magento admin dashboard 404 error after trying to login

404-pageadminmagento-1.7

My Magento (1.7.0.2) is installed in a subfolder. It was all working fine until couple of days back after hacked. The htaccess files are now being sorted correctly. The home page, categories & product pages are working fine (they were throwing me 404 errors`.

Now, still having issues with Admin Dashboard when I enter login details – it shows me "Whoops, our bad…" error.

The URL shows domainname.com/index.php/admin/index/index/key/62f8f/

I've removed index.php from all URLs, still it shows up here!

What could be missing, which is not letting me login to admin dashboard?

TIA

Best Answer

Finally after hours of exploring, I've managed to fix an issue by hard-coding Admin URL generation in /app/code/core/Mage/Core/Model/store.php by overriding the _updatePathUseRewrites method.

Find this snipped in above mentioned file

protected function _updatePathUseRewrites($url)
    {
        if ($this->isAdmin()
            || !$this->getConfig(self::XML_PATH_USE_REWRITES)
            || !Mage::isInstalled()
        ) {
            if ($this->_isCustomEntryPoint()) {
                $indexFileName = 'index.php';
            } else {
                $indexFileName = basename($_SERVER['SCRIPT_FILENAME']);
            }
            $url .= $indexFileName . '/';
        }
        return $url;

And make the following change $url .= '/'; to ensure there is no index.php prefix.

Also wrote a whole post regarding all 404 issues I faced after the hack. If you're in similar situation & need to save tons of hours - hope this article helps. http://techzoom.org/fixing-magento-404-error-whoops-on-all-pages-admin-dashboard-after-login/

(Moderators, please remove the link if you think it's inappropriate)

Related Topic