Hi,
We are creating a globalized EPiServer web site where several different domains will point to the same web site. However, we would like to return different content when robots.txt is requested depending on which domain name/host name the request is made from.
For instance, when domain.se/robots.txt is requested, we would like to return the content of robots.txt.se, and when domain.com/robots.txt is requesed, the content of robots.txt.com should be returned. This should be transparent to the robot/visitor that actually makes the request.
I've managed to do this by adding an event handler in Application_OnStart in global.asax:
UrlRewriteProvider.ConvertingToInternal += new EventHandler(UrlRewriteProvider_ConvertingToInternal);
In the UrlRewriteProvider_ConvertingToInternal method, I then get the e.Url (UrlBuilder) object and modify the Path property depending on certain rules (Regular expression).
Seems to work fine. However, I have a few questions about this.
1. Is this the way you're supposed to modify URLs? Writing your own subclass/implementation of FriendlyURLRewriteProvider isn't neccesary in this case, right?
2. Is the global.asax application_onstart the correct place to add this event handler?
3. Might there be any performance penalty since the UrlRewriteProvider_ConvertingToInternal method is called very frequently?
We're thankful for any ideas or input!
Thanks,
Christoffer