Virtual Host Redirects


After a discussion with a friend and colleague today about redirects from a non-canonical domain name(s) to the canonical domain name, I figured I'd put up a post about it both as a reference and for others to find. So, if you are interested in how I'm doing the HTTP redirects from the non-canonical domain names (below) to this canonical domain name, head over and read my Virtual Host Redirects article.

For Convenience, I'm putting a link to this post on the non-canonical domain name so that you can easily see and test how it works your self.

Notice how both of the links above bring you back to this same page? Did you see your browser flash to the non-canonical URLs and then immediately come back here? That's how it's supposed to work.

See Hosting.com's Common rewrite rules for .htaccess article for examples of rules that are using one (or more) RewriteCond(ition) rules to determine if the domain in in use is the canonical domain or not. This is exactly what using additional Virtual Host(s) is meant to address.