“My site is down! Fix it!” Redux part II
by
on Friday, October 13, 2006
Okay, so it was a little bit longer than a few days, but this site has moved to it's new (and hopefully, final) location and server.
Technobabble and an apology
To the one person who's currently subscribed to the Atom feed, I must apologize for
screwing up the entry IDs
and throwing a whole batch of previously read entries as new. The
software used for this blog, mod_blog has very minimal
support for entry IDs and
no support for preserving IDs across domain moves. But I
wasn't expecting the
Spanish Inquisition Mistah Wheelus to get this
blog its own domain name.
Sorry.
When I originally changed the domain of this blog, just the domain changed, not the server is was on. Since we run Apache, it was a simple matter to configure the webserver as:
<VirtualHost 66.252.227.139> ServerName saltmine.pickint.net ServerAlias pb1.flummux.org # A whole bunch of other directives # that we needn't get into at this # time ... </VirtualHost>
Notice how the old domain name was configured as an alias. This told
Apache to respond to pb1.flummux.org as well as
saltmine.pickint.net. The reason for this is to prevent any
links (like there were any at that time) from breaking. It also meant that
any search results (like any search engine had actually indexed the site at
that time) wouldn't break either, and that's a very important
thing.
But since we not only changed names, but server as well, such a trick won't work. And by this time, we have been indexed, and have a few links and whatnot. In this case, to prevent the links (and to keep any Google juice we might have) we have to take a different approach.
So, after setting up the new domain and making sure the blog works on the new server, I went back to the original server, and made a slight change to the configuration:
<VirtualHost 66.252.227.139> ServerName saltmine.pickint.net ServerAlias pb1.flummux.org Redirect permanent / http://www.saltminechronicles.com/ # every other directive has been deleted, # as they're not required any more </VirtualHost>
This particular Redirect
directive of Apache instructs web browsers that everything on the
site has moved permanently to a new location and to use that location from
now on (and a browser should update any bookmarks for the old site
to use the new site without having the user do anything).
Technobabble
The web protocol, HTTP, includes a mechanism to inform the client side (that's the browser) that a resource (say, an image) has moved to a new location—a “redirect.” The two most common types are the “temporary redirect” and the “permanent redirect” and they are pretty much what they say.
From the actual protocol (which seems pretty straightforward to me):
10.3.2 301 Moved Permanently
The requested resource has been assigned a new permanent URI and any future references to this resource SHOULD use one of the returned URIs. Clients with link editing capabilities ought to automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible. …
10.3.3 302 Found
The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. …
(Just for the record, a URI is a more technically “pure” term for a URL and has a specific meaning. If you really want to be pedantic about it, all URLs are URIs, but not all URIs are URLs. But this is a bit too much heavy wizardry even for the Technobabble sections.)
And the Redirect can be used even if you aren't planning on
moving your site to a new domain name, it can be used when you reorganize
your website. Here's an example from a friend's site after he restructured his
site:
Redirect permanent /software/seminole http://gladesoft.com/products/seminole/ Redirect permanent /software/seminole/ http://gladesoft.com/products/seminole/
Nothing else on the site changed except for the renaming of the
software folder to products. No links were
broken, and more importantly, no Google juice was lost.
Fortunately, the Redirect directive is not restricted to the
main Apache configuration file (which you probably don't have access to if
you don't host your own site)—they can be placed within an
.htaccess file (which is a file that resides within your
webhosting space on the server).
So hopefully, this is the latest last location of this blog and it won't be changing any time soon.