Saturday, October 25, 2014

Magento site redirecting to localhost

The Redirect problem was due to Magento cache. I Simply deleted everything from the /var folder of my Magento site. After that I cleared my browser's cache/cookies for good measure & it worked!

Changing Magento base URLs

OverviewThis article shows how to change Magento Base URLs through PHPMyAdmin and the command line. 

 Method 1: changing Magento base URLs in Magento adminstrator panel

  1.  Log into your Magento admininstrator panel.
  1. On the top menu bar, click System > Configuration.
  1. On the left menu, click Web.
  1. Open the Unsecure and Secure dropdowns, locate the base URL line, and replace this with the new URL.  
  2. Clear the Magento cache and your browser's cache. The site should load properly now.   

Method 2: changing Magento base URLs through PHPMyAdmin

  1. Log into your SiteWorx account.
  1. On the left menu, click Hosting Features MySQL > PhpMyAdmin.
  1. You will be brought to the main menu for phpMyAdmin.  On the left side of the screen, locate and click the name of the Magento database corresponding to URL you want to change.   
  1. You will see a list of all the tables in the database in alphabetical order.  Search for the core_config_data table and click Browse.
  2. Expand the viewing area of phpmyadmin. At the top and bottom in the main panel, locate the grey box and change the number of rows to a larger number, such as 100.
  1. Locate the rows web/unsecure/base_url and web/secure/base_url and click Edit next to the corresponding lines.  Change the base URL to the intended string, and click OK.
  2. Flush the Magento cache, and the site should load with the set base URLs properly now.   

Method 3: changing Magento base URLs through the command line

Attention: Due to the possibility of irreparable damage, do not attempt to change the base URLs unless you are an experienced technician. 
  1. Log into the client's server using terminal.
  2. Gain access to MySQL using m or mysql -u root -p.
  3. Access their database using the following commandwhere database is the database name.
use database
  1. Run the following command: 
select * from core_config_data where path like '%base%url%';
      5.  This will display the current base_urls set in Magento
      6.  To change the base URLs, execute the following commands:
update core_config_data set value = 'http://domainname/' where path = 'web/unsecure/base_url';
update core_config_data set value = 'http://domainname/' where path = 'web/secure/base_url';

- See more at:

Admin Login Problem

Option 1:

Update (For Magento 1.4.*) and higher versions
In Magento 1.4 and higher versions, you have to comment code below which is present around line 80 to 100 in
/*  if (!$cookieParams['httponly']) {
    if (!$cookieParams['secure']) {
        if (!$cookieParams['domain']) {
if (isset($cookieParams['domain'])) {
    $cookieParams['domain'] = $cookie->getDomain();
} */


Option 2:

Stop modifying the core code like that — it may temporarily solve an issue, but it may create future issues that will be almost impossible to track down.
There's a number of different issues that cause the errorless admin login behavior you're seeing, but they all go back to Magento not being able to set or read the session cookie. Magneto uses sessions to pass error messages between pages — that's why you don't see an error message. Magento also uses sessions to store the "is logged in" value, so not setting sessions also causes the core error behavior.
Possible causes include
  • Local computer time vs. server time mismatch, causing instant cookie invalidation. Make sure your server time is correct.
  • Incorrect permissions on var/session, preventing session files from being saved
  • Incorrect configuration of database/redis/other session storage, preventing saving of session values
  • A module is instantiating sessions to early, preventing the correct session names from being set
  • You're a developer using multiple URLs and have multiple cookie domains
  • Another developer has somehow modified app\code\core\Mage\Core\Model\Session\Abstract\Varien.php, creating a hard to track down bug
  • The cookie domain in System -> Configuration -> Web -> Session Cookie Management doesn't match the actual site domain.
  • You're using the localhost as your server domain, and using a version of webkit that has trouble/bugs setting cookies for localhost in some situations.
The short term fix is to just delete your cookie for the domain. That's often enough to solve the problem. If it persists, figure out which of the above reasons is the reason for your error, and take steps to address it (fix permissions, etc.)

Notes on How to Install Magento

  1. Downloaded magento-, decompressed.
  2. Run the wizard and used the following information: 
  3. Done.