In the part 1 of the series, I introduced an option to Host a static website in Azure blobs. In part 2. I discussed how to set the content type of the Azure blob contents so that it is rendered properly across all browsers. Now, In this post, I am going to address following considerations:

1. Mapping our unfriendly azure storage domain name to a friendly domain name like xyz.com

2. Logging Blob Request in other words logging the site visitors.

3. handling Directory structure of the website (applicable for huge static websites – no kidding – such sites do exist)

Ok, let’s get started. The first concern is to name a domain like paras.blob.core.windows.net to a custom domain name like xyz.com ; The good news is that is it is easily doable using the Azure management portal. Here is the snapshot of the Azure management portal feature that let’s you do it.

So now you once i have mapped “paras.blob.core.windows.net” with “xyz.com”, the URL of the site becomes “xyz.com/demo-solidq-ste/default.htm”  – Here, demo-solidq-site is the name of the public container and default.htm is the Home page. Remember that Azure blobs does not support default document so if you just specify the URL – http://paras.blob.core.windows.net/demo-site-solidq/ without adding default.htm at the end you will get an error.

But the above URL “xyz.com/demo-solidq-ste/default.htm” is not user friendly. Though it’s a little shorter than the original one.

So if you wish to just want the end user specify xyz.com – then I think you should consider URL forwarding. you could setup the URL forwarding for xyz.com to  http://paras.blob.core.windows.net/demo-site-solidq/default.htm. Now, I am no SEO expert but based on my little research, I understand that a 301 redirect from “<OUR-LONG-URL>” to “xyz.com” is the way to go. No 302 redirects and No masked forwarding. A simple 301 redirect that is search engine friendly. The benefit of this mechanism being we can just flaunt xyz.com and let the domain redirecting mechanism do the rest.

Now, the next consideration is to log the visitors for your static website hosted in Azure blobs. As of now there is no such facility available with Azure storage – so one has to look for third part apps. Update: Azure storage analytics, which was not released when I wrote this post, can be used to get this information, learn more:  http://msdn.microsoft.com/en-us/library/hh343270.aspx

[Old: One of them is google analytics. it is very easy to setup. so just paste the javascript code that they provide in the between the <head> tag in every html page of the website. I was easily able to do so. Just remember one thing – when they ask you to provide the website URL – specify the whole URL http://paras.blob.core.windows.net/demo-site-solidq/default.htm (along with default.htm)

Now the last consideration is handling the directory structure of the website. I realize that it is important if a static website has lot of content. it is necessary to organize it – now, here we are going to handle it a bit differently since we are not allowed to create another container inside our existing container. But one can add the character ‘/’ in the blob name so when you create names for the blobs – you could name it images/justanimage.jpg which looks then looks like a directory structure. Smart deception – huh!?

Here are two blobs I created which look as if they are in an ‘images’ folder

That’s it. I hope you liked the blog post – do post your comments/feedback.

Update:

One of the reader [Nathan Parker, Mallard Computers] of the post emailed an option to map the azure storage domain to a custom domain. I liked it – so posting it here for you (with his consent)

1. Map the <accountname>.blob.core.windows.net to <cutomdomain>.

2. Forward <customdomain> to <customdomain>/containername/default.htm

Thanks Nathan.