Site structure
Version 4.x > Site structure > favicon.ico and sitemap.xml on shared installations View modes: 
User avatar
Guest
Internet Geeks - 9/25/2009 4:52:50 AM
   
favicon.ico and sitemap.xml on shared installations
Hi,

I've come up with a slightly different solution to having different favicons and sitemap files for sites which are hosted in a shared installation. The solution involves the use of the wonderful ISAPI rewrite module by http://www.helicontech.com. To get this working I've renamed are favicons and sitemap files using the following format:

favicon-<hostname>.ico
sitemap-<hostname>.ico

For example, the favicon for http://www.internetgeeks.co.uk becomes favicon-internetgeeks.ico.

I've then used the following rules to rewrite the requests to the correct files:

RewriteCond %{HTTP:Host} ^(?:www\.)?(.*?)\.(.+)$
RewriteRule ^sitemap.xml /sitemap-%1.xml [NC,L,NS]

RewriteCond %{HTTP:Host} ^(?:www\.)?(.*?)\.(.+)$
RewriteRule ^favicon.ico /favicon-%1.ico [NC,L,NS]

(Please note that the rules above are for ISAPI rewrite version 3)

....and hey presto! You should be able to have separate favicons and sitemaps for your sites. In fact you can use this method to rewrite any type of file that needs to be located in the root directory of your site e.g. robots.txt or even app_offline.htm.


Kevin Smith
Internet Geeks
http://www.internetgeeks.co.uk