Purpose :
Redirect https://10.10.10.10 URL to https://mydomain.com
Solution :
Define Rewrite Rule in Apache Tomcat
1. Backup the context.xml file under conf directory and add below entry to the file
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve"/>
2. Create a file rewrite.config under webaapps\ROOT\WEB-INF folder.
Example : D:\Apache\Tomcat 9.0\webapps\ROOT\WEB-INF\rewrite.config
3. Add the below rewrite rule in rewrite.config file and save the changes
RewriteCond %{HTTP_HOST} ^10\.10\.10\.10$
RewriteRule ^(.*) https://mydomain.com/$1 [L,R=301]**Optionally also copy rewrite.conf file to conf directory
4. Restart Tomcat Service
5. Access URL https://10.10.10.10 it will redirect you to https://mydomain.com
No comments:
Post a Comment