Magento – Admin Login redirecting after login

.htaccessadminmagento-1.9url

I have cloned my 1.9.1 install to a subdomain successfully. However an odd behavior is occurring. When I attempt to login to the admin, the page reloads, the login fields are blank, and I noticed that the url has redirected me to the original domains url.

magedev.example.com/index.php/admin (enter credentials, click login)

the page reloads as:

www.example.com/index.php/admin/index/index/key/9654a53e6793hu57dys624b51a6673e362/ 

I've changed secure and unsecure URL's in the DB. I deleted all entries in core_url_rewrite. Is this an .htaccess issue? I swapped out the sub-domain where I thought I should below.I haven't changed anything else here and probably should, but am unsure exactly what is needed. There's much more to the file but this seemed to be the only part that could be involved?

RewriteCond %{HTTP_HOST} ^website.com$
RewriteCond %{HTTP_HOST} ^www\.website\.com$
RewriteCond %{HTTP_HOST} ^website.com$
RewriteRule ^/?$ "http\:\/\/www\.website\.com\/" [R=301,L]

SetEnvIf Host www\.website\.com MAGE_RUN_CODE=default
SetEnvIf Host www\.website\.com MAGE_RUN_TYPE=store
SetEnvIf Host ^website\.com MAGE_RUN_CODE=default
SetEnvIf Host ^website\.com MAGE_RUN_TYPE=store

became

RewriteCond %{HTTP_HOST} ^magedev.website.com$
RewriteCond %{HTTP_HOST} ^magedev\.website\.com$
RewriteCond %{HTTP_HOST} ^magedev.website.com$
RewriteRule ^/?$ "http\:\/\/magedev\.website\.com\/" [R=301,L]


SetEnvIf Host magedev\.website\.com MAGE_RUN_CODE=default
SetEnvIf Host magedev\.website\.com MAGE_RUN_TYPE=store
SetEnvIf Host ^website\.com MAGE_RUN_CODE=default
SetEnvIf Host ^website\.com MAGE_RUN_TYPE=store

The first section redirected me to the old site immediately. The edit behaved as mentioned above. It takes my credentials, reloads the page from the old url and wants me to log in again. Clearly I am missing something. I put in the stock fresh install .htaccess, and its still redirecting. I've searched the DB for any instance of the old domain name, and it only appears in an extension that isn't relevant to the admin loading.

Best Answer

Do the followings:

  1. According to magento takes all config data from cache folder you have to clear the magentodir/var/cache - including all subfolders - to be sure the new config is taken.

If above not works then do the below step:

  1. also login to Phpmyadmin or any database method to empty the table core_url_rewrite (remember back up it first to make sure you have no risk).

I hope it will help you.

Related Topic