Another challenge when migrating balthisar.com from shared hosting to S3/CloudFront was deciding how to transition from the use of so-called “cool URIs” to the traditional URIs supported by Amazon Web Services.
After the oh, crap moment when I made a newbie mistake with CloudFront circular references, I decided to accelerate my longer term plan to move to S3 for hosting. Because S3 doesn’t support slashless directory names, I had to decide how to handle links.
Until recently all of balthisar.com used “cool URLs”, meaning that references to
/sample/article.html were obfuscated by placing the real file in
/sample/article/index.html. So far this old-fashioned behavior; directory index files
have been around forever, and allowed access via
/sample/article/, because the
index.html would be served automatically by the server.
However “cool URLs” go one step further and forcibly remove the trailing slash externally (what
you see in the browser), yielding us
/sample/article. Internally, however, the trailing slash
is maintained so that the server works.
S3, while it supports index documents —
/sample/article/ has an implied
index.html — doesn’t
support cool URLs, i.e., doesn’t allow
/sample/article with an implied
caused me to reevaluate my use of cool URLs (given that I had no choice in the matter), but also
to why I wanted them in the first place.
But first on to practical matters! Update the website links to use trailing slashes, and
.htaccess to force trailing slashes for directories, and make sure all of the
301 redirects are in place, and update all of the canonical metadata information in order
to ensure that I wouldn’t be punished too harshly by the search engines for invalidating
all of my links or risking duplicate content.
This was the easy part, and also important to do on the original host so that things would work properly and consistently during the S3 and CloudFront deployment process, and until DNS servers globally caught up.
I'm pretty confident that I managed to prevent link rot while successfully migrating away from cool URLs.