Saturday, January 06, 2007

Blogger Custom Domain and my experiences

Google released a new "custom domain" option for Blogger. It's just a DNS setting which allows you to use your domain with Blog*Spot. You pay for the domain. Google pays for the hosting. I don't need to save the money but as this a kewl new toy from Google - I made the move and then thought about it later. Heh.

This blog used to use the URL www.arhg.net/blog/. It seems Google (the people at Blogger) didn't think about people who published to a folder. I'm sure not everyone FTP publishes to the root of their domain. In fact, I suspect more people publish to a folder or directory than root. The Custom Domain option doesn't cope with this very well.

After the DNS change filtered through my blog moved to www.arhg.net. The links and images in the blog, however, still pointed to www.arhg.net/blog/ and there was no /blog/ folder at Blog*Spot.

Simply put - the change broke the blog.

Here's the fix. I took back control of www.arhg.net and told Google to publish the blog to blog.arhg.net. That happened quickly. The links and requests for images at www.arhg.net/blog/ remained in place.

I used .htaccess to redirect anything in the /blog/ folder which ended in .html or .xml to the new blog.arhg.net. Since the images hadn't moved they weren't included in the redirect rule.

A quick way of applying redirects to just the /blog/ folder is to put the .htaccess in the /blog folder.

Here's my .htaccess rules.
RewriteEngine On
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^arhg.net$ [NC]
RewriteRule ^([0-9]*_[0-9]*_[0-9]*)_arhg_archive\.html$ http://blog.arhg.net/$1_archive.html [L,R=301]
RewriteRule ^(.*)\.html$ http://blog.arhg.net/$1.html [R=301]
RewriteRule ^atom\.xml$ http://blog.arhg.net/feeds/posts/default [R=301]


In time I'll move the images over to Google. Just to keep things neat.

In summary - did the custom domain option break your images? Publish to a sub-domain and redirect the .html and .xml files to the new address.

1 comments:

Paula Neal Mooney said...

Thanks for the tips. I'm making the switch to a dot com soon from blogspot URL and I needed them!

I like this guy's method:
http://www.sciencetext.com/blogger-custom-domain.html#comment-62

But thanks for describing the .htaccess changes you had to make.

Happy Friday,
Paula