I recently copied over my live site along with database to my WAMP folder and now every time I try to get to the Backend, it redirects me to the homepage. I'm curious if there is something in the database that I have to change. I had to rewrite the core_config_data /base_url in order to get it to stop redirecting to the live site when I typed Localhost and I'm curious if it's an entry in my database that is causing it to reroute to the local Frontend. I've tried localhost/admin localhost/index.php/admin and others. Let me know if any code would help answer the question.
Magento – WAMP Admin login does not work, redirected to frontend
adminbackend
Related Solutions
Those error reports are stored in PHP's serialized format — you can unserialize them with code that looks something like this
$contents = file_get_contents('path/to/report');
$thing = unserialize($contents);
var_dump($thing);
If you do that, you'll get the items broken out into an array, making it a little easier to read
array(5) {
[0] =>
string(96) "SQLSTATE[HY000] [1045] Access denied for user \'avant_jonathan\'@\'localhost\' (using password: YES)"
[1] =>
string(1302) "#0 C:\\wamp\\www\\includes\\src\\__default.php(53987): Zend_Db_Adapter_Pdo_Abstract->_connect()\n#1 C:\\wamp\\www\\includes\\src\\__default.php(54460): Zend_Db_Adapter_Pdo_Mysql->_connect()\n#2 C:\\wamp\\www\\includes\\src\\__default.php(52674): Varien_Db_Adapter_Pdo_Mysql->_connect()\n#3 C:\\wamp\\www\\includes\\src\\__default.php(53730): Zend_Db_Adapter_Abstract->query(\'SET NAMES utf8\', Array)\n#4 C:\\wamp\\www\\includes\\src\\__default.php(54566): Zend_Db_Adapter_Pdo_Abstract->query(\'SET NAMES utf8\',"...
'url' =>
string(6) "/admin"
'script_name' =>
string(10) "/index.php"
'skin' =>
string(7) "default"
}
So, using the above, your error message (the first array index) is
SQLSTATE[HY000] [1045] Access denied for user \'avant_jonathan\'@\'localhost\' (using password: YES)
PHP is telling you it can't access the database with the configured information.
Open up
app/etc/local.xml
and look for the following section
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[avant_jonathan]]></username>
<password><![CDATA[XXXXXXXXXX]]></password>
<dbname><![CDATA[magento]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
Change the host
, username
, and password
to match your local settings.
For Magento to see your changes, you'll need to clear all the files out of /path/to/magento/var/cache/*
, as Magento caches the contents of local.xml
there.
Reload your home page (or any page except the error report page) and you should be good to go. (Or, good to move on to the next exception)
This is a very well documented issue - Ashley Schroder put together a great compilation of the well-known issues with admin login problems:
http://www.aschroder.com/2009/05/fixing-magento-login-problem-after-a-fresh-installation/
This is the most common solution, if you have set up Magento to run locally (on MAMP for example) then you may be accessing the Apache webserver using the localhost hostname. A security setting in browsers means that the cookie will not be set, though apparently in FF3 at least, this behavior is a bug?.
So simply stop using localhost, you can use your localhost interface (e.g. 127.0.0.1 or 127.0.1.1). To determine your localhost interface you can look at the contents of your hosts file:
In your case it looks as if you need a "." in the domain name. Some example domains that will work are local.dev
, magento.local
, 127.0.0.1
- again, anything with a "." in it.
Best Answer
If you are being redirected, the question is, does magento anything or is it the apache.
Apache
.htaccess
for any unwanted redirectsMagento
app/etc/local.xml
what the admin path is in the nodeadmin/routers/adminhtml/args/frontName
core_config_data
or thelocal.xml
for the nodesadmin/url/use_custom
(has to be 1) andadmin/url/custom
for the url