by bmelton · 15y ago · 0 comments
The first is to create a vhost in your webserver that serves an index.htm page on your NON-www url. The contents of that page would simply redirect users to the www.yourdomain url.
If that seems like too much work, an even easier fix (truncated for brevity) is to do something like this:
var url = window.location.href;
if(url.indexOf("http://www") != 0) {
window.location.replace("http://www.yourdomain/");
}
You'd obviously want to capture the remainder of the querystring and add it in, but that's the general idea. RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]Even better, just use http://wwwizer.com/ (look for the free redirect service banner on top).
A simple solution, which I've used--and I think the OPs situation is similar--is to just have an additional A-record pointed to the ELB, this should work unless the OP is doing something really fancy. No need for route-53, even go-daddy will let you do this.
However, route-53 gives you much better TTL, so if you ever need to re-route..
http://googlewebmastercentral.blogspot.com/2009/02/specify-y...