(Note: This post somewhat of a story, but also has some useful code design info.)
This allows you to use MyExample.com to reference your blog, instead of something like myexample.typepad.com.
All of your posts and images use the original name, such as in search engine listings, on trackbacks and more. So if you change the name, all of your old links will break. You might loose a bunch of RSS feeds that used the old links. And also, all of the images in your posts will be missing!
I ran into this issue for a client last week. A popular blog, with an average of 1,500 unique visitor per day, and over 2,100 posts, was essentially broken. Not acceptable.
Because of TypePad’s inept support I was forced to find a solution, which can likely be adapted for use on other hosted blogging systems as well. The answer lies in some simple .htaccess code. Read on to find out more.
First, a rant against TypePad. TypePad doesn’t have live support. At all. Six Apart, the parent company, doesn’t even maintain their own support forums. With no other recourse to solve the issue, I opened an online help ticket.
We were told that the issue was a tough one, and would be looked at by technical support. After a week of back and forth, asking if there was any progress, TypePad finally responded that there was nothing at all they could do.
I tried asking @sixapart on Twitter for help. No response whatsoever.
Ouch! I called GoDaddy.com, where the domain name is registered, to see if their live support team had any ideas. While they were helpful and friendly as ever, they didn’t see how to fix the problem. But that’s when I myself realized how to do it.
An .htaccess file is a text-only file that web servers read first, before any other pages on a site. Turns out it’s a common way to fix issues that might occur when you switch your domain name!
In TypePad, all blog posts live in a sub-folder of your main domain, like “my_example”. In this case, the original links, now broken, were www.myexample.com/my_example/my-post.html, and the new links, after changing domain mapping, were blog.myexample.com/my_example/my-post.html.
Very similar links, and a simple replacement: just find anything with the /my_example/ in its address and send it to blog. instead of www.
To create an .htaccess file, all you need is a simple text editor. Open the file, type in your code, and save with the extension .htaccess. You might have to give the file a name, like a.htaccess, but just make sure to remove the preceeding “a” before uploading to your webserver. [More on .htaccess files here and here.]
For this specific redirect, the code in the .htaccess file is the following:
Redirect 301 /my_example/ http://blog.myexample.com/my_example/
It worked to fix all the old, cached, search-engine-indexed, mentioned-by-others posts’ links. However, images are a separate line of code.
In TypePad, all images you upload to their severs are stored not in your /my_example/ folder, but in a directory called /.a/
Why? Who knows. But all that means is we need another line in the .htacess file:
Redirect 301 /.a/ http://blog.myexample.com/.a/
Upload the file to the root level of your site, and done. Phew. SixApart, please take note, and save other customers some anguish.