We are systematically creating races out of things that ought to be a journey.
extract from Charles Wheelan (as seen at http://online.wsj.com/article/SB10001424052702304811304577366332400453796.html)
I've been experimenting with hosting static websites on Google App Engine(GAE) for a while now. One major deterrent to an otherwise straight forward procedure was the fact that GAE did not automatically serve index.html when encountering static folders. Now that I found this workaround on Stack Overflow, the static website is ready for GAE!
But there was another hurdle waiting.
GAE's instructions on using custom domain names for GAE hosted apps did not work. Specifically, Step 5 (Add New URL), failed with the following error:
We are unable to process your request at this time. Please try again later. (Error #1000)
After a bit of searching and experimenting, only this apparently silly technique actually worked. Along with naked domain redirection, this is now a static site, fully hosted on Google App Engine. Even though this runs off GAE, there are zero machine instances running. This can be verified in the app.yaml not relying on any executable script.
Update: GAE does not currently support custom 404 handlers. So, until then, back to Amazon S3 hosting.
Here's a problem I've long faced and a neat use of Levenshtein Distance.
However, since the blogger hosted site still got a lot of traffic from search, I did not take it down. I've always wanted to redirect the traffic to my new website, but Blogger apparently only features redirects in the other direction. While Webupd8.org has a solution, I could not get it working in this case. There were at least two problems that were in the way:
- URL structure of the current website also includes the date of publication, in addition to the year and month.
- while migrating to Jelyll, some of the URL 'slugs' also changed.
- I did not want to host a server to do this; I had tried this and have moved on.
To deal with these two and also handle correct redirects automatically, here is my quick solution:
- On the blogger.com hosted website, place a redirect to a special page to handle redirects from blogger (in this case, /blog/blogger-redirect.html).
<meta expr:content='"0;url=http://saicharan.in/blog/blogger-redirect.html?from="+data:blog.url' http-equiv='refresh'/>
- This special page first detects the 'referer', then extracts the year, month and slug from the blogger URL. If the referer is not found, extract the query parameter
from. This is a minor optimization in case referer is set (eg. with Google Chrome); one could simply always use the query parameter method (IE and Firefox seem to remove
- It then lists the URLs on the month-page (eg. /blog/YYYY/MM/) of this website, and computes the Levenshtein's distance between the blogger-slug from the blogger URL and the slugs from the month-page URLs.
- If the minimum amongst the computed Levenshtein distances is less than 5, automatically redirect to the URL with that minimal Levenshtein distance (example).
- If not, admit that we made a booboo and list all pages for that month, and additionally providing the search box (example).
- I am pretty sure this may affect the SEO ratings, but I am unsure how exactly that will be. So, if you use it, be cautious.
- This is the source code for my solution.
- Yes, the source code could do with some more optimization :/
Migrating between hosting and blogging solutions can cause headaches. Now that I've moved to an Amazon S3 hosted static website, I needed an intelligent way to handle certain features like tags and categories that I had with the blogger.com and Wordpress hosted site, without the need to host a server.
- I first identified the specific causes of problem using the crawl statistics from Google's Webmasters tool.
- Put that into my 404.html.
This solution is specific to my use case, but you can get the idea.