I am using a tomcat server and I have installed the SSL by changing strings in server.xml and web.xml file.
Problem is, When I browse with domain.com, www.domain.com, in both the cases it is browsing. But I want it to redirect to domain.com only.
How would I do that?
Any help would be appreciated.
Thanks
This can be achieved by Rewrite Valve, it's pretty similar to mod_rewrite in httpd :
1- Include rewrite valve in your global context file context.xml or your host context server.xml , I recommend it here :
2- Create rewrite valve configuration file under the host configuration folder as the above :
3- Write your rewrite rule and save the configuration file :
3- Restart tomcat
For a comprehensive review, check the official documentation