If you are using Apache, just do (on htaccess):
RewriteEngine On RewriteCond %{HTTP_HOST} ^yourdomain.com RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301]
This way you will see that everything that www does not use starts using
UPDATE As you already mentioned, you do not have Apache, I remembered that a year ago I used this one . This is almost the same as mod_rewrite, and is fully supported by Tomcat. I used it with resin, though, but I know that it works the same.
The most important thing about this is that it also works on the "mod_rewrite style", as you can see here . The only reason I did not continue to use it is because it will do this at the server level, as opposed to the web server level. It is understood that this will cause the JVM to interpret the redirect.
It works the same, but, as mentioned earlier, it can sue in the same way as you would use on Apache.
Marcos placona
source share