Reputation: 433
I am following an example in a Magento book which calls for the following to be written inside the .htaccess file:
SetEnvIf Host www\.acmefurniture.com MAGE_RUN_CODE=furniture_en
SetEnvIf Host www\.acmefurniture.com MAGE_RUN_TYPE=store
SetEnvIf Host ^acmefurniture.com MAGE_RUN_CODE=furniture_en
SetEnvIf Host ^acmefurniture.com MAGE_RUN_TYPE =store
SetEnvIf Host www\.acmeelectronics.com MAGE_RUN_CODE=electronics_en
SetEnvIf Host www\.acmeelectronics.com MAGE_RUN_TYPE=store
SetEnvIf Host ^acmeelectronics.com MAGE_RUN_CODE=electronics_en
SetEnvIf Host ^acmeelectronics.com MAGE_RUN_TYPE =store
SetEnvIf Host www\.acmeoutdoor.com MAGE_RUN_CODE=outdoor_products
SetEnvIf Host www\.acmeoutdoor.com MAGE_RUN_TYPE=website
SetEnvIf Host ^acmeoutdoor.com MAGE_RUN_CODE=outdoor_products
SetEnvIf Host ^acmeoutdoor.com MAGE_RUN_TYPE=website
I would like to use such an example except that I am running an xampp server on a Windows 7 machine behind a firewal and do not own several domain names.
So what I would like to ask, what can I use in place of acmefurniture, acmeelectronics, and acmeoutdoor on a localhost server (where I am only beginning to test magento)?
Of course, once out on the web a similar example would require the web store maintainers to purchase their own domains etc... but for now I was just wondering what to do to see how the pages in the example show up on localhost.
I have tried modifying my C:\Windows\System32\drivers\etc\hosts file and adding the following lines:
and then writing the following inside my C:\xampp\htdocs\magento.htaccess file:
SetEnvIf Host en.furniture.localhost MAGE_RUN_CODE=furniture_en
SetEnvIf Host en.furniture.localhost MAGE_RUN_TYPE=store
SetEnvIf Host en.electronics.localhost MAGE_RUN_CODE=electronics_en
SetEnvIf Host en.electronics.localhost MAGE_RUN_TYPE=store
SetEnvIf Host products.localhost MAGE_RUN_CODE=outdoor_products
SetEnvIf Host products.localhost MAGE_RUN_TYPE=website
but with this change when I point my browser to
http://en.furniture.localhost/magento
or
http://products.localhost/magento
I still get the same result. I was supposed to get two different pages.
Anyone have any idea why I am getting the same page in both cases?
How can I configure my Windows 7 + XAMPP + Magento environment so as to get different sites in both cases?
Thanks,
John Goche
Upvotes: 0
Views: 1775
Reputation: 12809
You could modify your windows host file to trick windows in to thinking those domain names point to your local machine:
for example, you would add:
127.0.0.1 somedomain.com
127.0.0.1 anotherdomain.com
When you type those into your web browser windows will try and look at your local WAMP setup for the domains.
You would then change your .htaccess like so:
SetEnvIf Host somedomain.com MAGE_RUN_CODE=[store1]
SetEnvIf Host somedomain.com MAGE_RUN_TYPE=store
SetEnvIf Host anotherdomain.com MAGE_RUN_CODE=[store2]
SetEnvIf Host anotherdomain.com MAGE_RUN_TYPE=store
where you would replace [store1] and [store2] with the store code for each store view which you can get from the magento admin (store management).
Upvotes: 0
Reputation: 9100
You can use any domain on your localhost. Even google.com. Just specify it in you hosts file. See more info here http://helpdeskgeek.com/windows-7/windows-7-hosts-file/
When you type in any domain name into your browser's address bar it first looks into the local hosts file. If the record is found there browser will send a request to a specified server which in your case is 127.0.0.0.
Upvotes: 1