Change robots.txt file dynamically by domain name.

28. July 2009 02:49 by Sasha in   //  Tags:   //   Comments

There are times when websites have different domain names but point to the same code base. The most common is a CMS system that hosts multiple sites.

As the robots.txt file sits in the root of a website it will apply to all domains running from that codebase.

A easy way around this issue is to use the free ISAPI rewrite DLL from Helicontech for IIS.

First create 2 files in the root of your site

robots.block.txt – to block acess

robots.allow.txt – to allow access

image

Once you install the DLL and go into the editor just add the following

image

Depending on the domain name of the visitor, this will either read in the content of the block file or the allow one into a robots.txt file.

Note: Your files need to have a .txt extension and the robots.txt file should not actually exist otherwise.

blog comments powered by Disqus

Webcoda, SharePoint Consultants & Web Development

Webcoda, Web Developers & Designers Sydney is a Microsoft Gold Certified Partner comprising a team of consultants who are experts in all aspects of Microsoft web technology from ASP.Net development to SharePoint administration.

Webcoda has a long history of producing outstanding results for clients large and small. We have helped companies grow from humble beginnings to multi-million dollar enterprises through technology.

We love what we do and this blog is our way of sharing info that we find interesting with the world at large. Please feel free to comment or drop us a line on +612 9370 3636

Month List

Page List