- Installed your Magento shop in one directory?
- Multiple domains pointing to that single install?
- Every, or some, of those domain represent different shop
- Do you use one single skin/template for every, or some, of those shops
- do you want all, or some, of these shops have their own favicon, based on the shop your looking at
- Do you use the Magento .htaccess file
Read on! This is how I managed to change the favicon based on the shop URL changing the Magento .htaccess.
This worked in my Magento 1.4.1.0 version, but will most likely work different versions as well.
I have a couple of shops running on one magento install. I use a basic layout which I use for all the shops.
So basically all my shops are looking the same.
They are in complete different markets segments, and some are part of the same branded shops and I wanted to make difference also by having different favicons
Start
Let's say we have got three domains running Magento; domain1.com, domain2.com and domain3.com
Step 1 - Create Your Favicon
Create a favicon for each domain.
I asume you know what a favicon is.
Name the favicons whatever you like.
I suggest you name them according to your domains.
- domain1.com > domain1.com_favicon.ico
- domain2.com > domain2.com_favicon.ico
- domain3.com > domain3.com_favicon.ico
Note; leave a, or the default, favicon.ico in your custom themes directory.
If there is no favicon in that directory, Magento will use the default icon and point the reference in the HTML header to the base directory.
Step 2 - Change the Magento .htaccess file
Open the .htaccess file based in your Magento root directory. Go to the section starting with <IfModule mod_rewrite.c>.
Below the enable rewrites part paste the following code (change the URL's to yours).
Click on the image to enlarge..
Final words
After uploading everything to your website you can check if it is working.
Do it by calling the favicon url directly. It even works on each (valid) directory.
- http://www.domain1.com/favicon.ico, http://www.domain1.com/about/favicon.ico etc. must result in showing you the domain1.com_favicon.ico image
- http://www.domain2.com/favicon.ico, http://www.domain2.com/about/favicon.ico etc. must result in showing you the domain2.com_favicon.ico image
- http://www.domain3.com/favicon.ico, http://www.domain3.com/contacts/favicon.ico etc. must result in showing you the domain3.com_favicon.ico image
You can even delete the favicon in your root directory for sanity.
note; most browsers cache favicons. Even clearing your browser cache will not result in showing your new favicon immediately. Especially Firefox.
Discuss this tweak
You can discuss this tweak in this forum post on Magentocommerce.com: http://www.magentocommerce.com/boards/viewthread/196656/
|