Alternate URLs in SDL Tridion 2011

Why?

Clients often ask about how they can configure alternate URLs for the Pages they manage in SDL Tridion. Normally I tell them it’s entirely possible, and talk a bit about how it would be handled. In a .Net environment, I explain, we’d likely use an HttpModule that queries a data source to find a matching target URL for the requested URL. This data source might be an XML file, or it might be a DB such as the Content Broker.

How?

My personal preference has always been using the Content Broker to handle this. The alternate URL information can be stored as metadata for the appropriate Page. This metadata is then available for query in the Content Broker. Nice and simple really – a request comes in, it’s checked against the metadata in the Broker, if a match is found we redirect to the target Page, otherwise the request continues as normal.

I won’t go in to the full technical details as the code can speak for itself. Follow the link below to the Tridion Practice site to find the code and documentation.

When?

That’s a very good question. Building this has been on my todo list for quite some time now (I have an email containing relevant information in Inbox from Septermber 2009!) but for various reasons have never found the time to put it together. Fortunately, in relation to an upcoming POC, I was able to find the time this week. Apart from some issues getting the module to trigger for requests without a file extension it was as easy as I’d suspected.

Where?

You can find the documentation and the source code on the Tridion Practice site. Feel free to post any questions on here if you have any.

Advertisements

2 responses to “Alternate URLs in SDL Tridion 2011

  1. For performance reasons, I dont let the http module look up every single request. Rather only deal with potential 404 codes. So on the way in, the modules lets the request go, but on the way out, check if the reponse status is 404, and if so, then kick in the alternate URL lookup mechanism.

    • I tried to hook up to the Error event, as indicated in some of the info I found on the net, but I couldn’t get that to trigger. It may be because I was testing with a URL with no file extension so the request was not making it to my app (IIS was determining it as 404 before getting to the app). Do you have any thoughts on how else to approach it?

      Of course, I didnt’ state it, but I wasn’t looking to create production standard code, merely provide a baseline to extend from 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s