开发者

MagentoCommerce development environment domain issue

开发者 https://www.devze.com 2022-12-15 23:07 出处:网络
I am working on a ecommerce based on MagentoCommerce. I use 3 environments: dev (on my local machine), staging and production (both on my dedicated server).

I am working on a ecommerce based on MagentoCommerce. I use 3 environments: dev (on my local machine), staging and production (both on my dedicated server).

The problem is that when I want to s开发者_C百科witch from local to staging, I have to edit my hosts file to point the domain used by Magento to my server's IP. However, this is time consuming and I was wondering what other magento developers out there were using as a strategy to not always have to change the hosts file when switching from an environment to another. Plus, when my ecommerce goes into production, I'll have to deal with 2 environments on the same IP.

The best would be if Magento had the domain hardcoded in only one file. That way I could keep different config files in each environment. Is that the case ? Otherwise, what places are domains "hard coded" ?


I'm running Magento on a Production server and a number of development and test domains.

The domain isn't hardcoded in any file - the domain is all in the database.

You have to change the secure base url and the unsecure base url when you move from server to server. Both of these are stored in the database and can be changed in the web based administration screens. When moving the database from one host to another, I use a script that does little but update these values. Here's the SQL you need to update these values:

update core_config_data
set value='http://whatever.com/'
where path='web/unsecure/base_url';

update core_config_data
set value='https://whatever.com/'
where path='web/secure/base_url';

You may also want to pay attention to the local.xml file where the database connection is configured. I'm sure that you'll want to have the different instances using different databases. In my configuration, I leave this file out of source control, and configure it just once for each instance.

0

精彩评论

暂无评论...
验证码 换一张
取 消