chandesh sanjay
asked on
301 redirect in tomcat server
Hi, anyone explain me how to do 301 redirect in tomcat server, my problem is i have a index.html file in root folder of tomcat server, where this index.html file is forwarded to another folder root/xx/ui/ folder where my original index.html file is present, so now i want to 301 redirect the root insex.html to ui/index.html file. Please anyone help me.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
https://blogs.iis.net/owscott/url-rewrite-vs-redirect-what-s-the-difference.
What version of tomcat are you using. I think past tomcat 8 you can use a rewrite valve. You can enable it by adding it to the context.xml file, so it looks something like this.
Open in new window
Then you need to create a file called rewrite.config and put it in the WEB-INF directory.
This will have you rewrite rule which can also set redirect codes.
Inside of the file you can put the following rewrite rule
Open in new window