Menu Close

Set domain name and port on MAGENTO

 

I manage a magento site where a live shop is running on one server on port 80 and a dev site is running on another server on port 3000. When copying the site from live to dev all I need to do is change two rows in the core_config_data table, having:

  • path=”web/unsecure/base_url”
  • path=”web/secure/base_url”

You need to add your port number at the end of the url and that is all. In my case those two rows look like this:

(config_id, scope, scope_id, path, value)
(default, 0, web/unsecure/base_url, ,http://www.dev-server.com:3000/)
(default, 0, web/secure/base_url, ,http://www.dev-server.com:3000/)

Note that I don’t have a certificate on my dev server so I am not using https as the secure base_url. If you wish to use https this setting should be changed to https and you should omitt the custom port at the end.

Modification of the standard .htaccess file is not needed, and should probably be avoided.

If you don’t have access to the DB you can try creating a php file which will modify the database using magento:

<?php
error_reporting(E_ALL);
ini_set('display_errors','1');

require_once ("app/Mage.php");
Mage::app('default');

$db =Mage::getSingleton('core/resource')->getConnection('core_write');

$db->query("UPDATE `core_config_data` SET `value` = 'http://dev-server.com:3000/' WHERE `path` = 'web/secure/base_url';");

$db->query("UPDATE `core_config_data` SET `value` = 'http://dev-server.com:3000/' WHERE `path` = 'web/unsecure/base_url';");
?>

You need to put this file in the root magento folder or change the path to Mage.php if you put it somewhere else.

Posted in News, Web Development

2 Comments

  1. creativewebinar.org

    Hey there would you mind stating which blog platform
    you’re using? I’m looking to start my own blog in the near future but
    I’m having a tough time making a decision between BlogEngine/Wordpress/B2evolution and Drupal.

    The reason I ask is because your design seems different then most blogs and I’m looking for something unique.
    P.S My apologies for being off-topic but I
    had to ask!

Leave a Reply

Your email address will not be published. Required fields are marked *