I cannot redirect my non www domain version to www with MovedContextHandler
, it does not have host to redirect to.
Both www.example.com
and example.com
point to my web server IP. When someone tries to open example.com
he is still able to access my site that way. I want for his browser to receive HTTP 301 redirection to www.example.com
instead. It is important for search rankings, as search engines must know example.com
and www.example.com
are one and the same.
As a bonus, when someone tries to access example.com/somepath/somepage.html
I want a HTTP 301 redirection to www.example.com/somepath/somepage.html
How do I proceed with that? Do I need to write my own handler or is there an easier way?