Tomcat base URL redirection
Name your webapp WAR “ROOT.war” or containing folder “ROOT”
URL Redirection/Rewrite on Tomcat
There is no RewriteEngine
directive in the RewriteValve
(cf. documentation), hence the parsing error you obtain.
The RewriteRule
directive works almost as Apache's mod_rewrite
directive with a twist: the pattern must match the entire URI path. Therefore you need to use:
RewriteRule /app/app.application(/.*)? /abc/app/app.application$1 [RL]
Tomcat URL Redirect Issue
Issue in rewrite.config file name.
Furthermore, Tomcat does not support dynamic/regex based contexts and that is because of well defined principles. If you have such a use case, I'd strongly advise figuring out the exact need for this and if you could improve the modelling.
Tomcat 9: valve redirection of http to https only works for base URL?
The RewriteRule was formatted for Tomcat 8 and was not suitable for Tomcat 9.
The equivalent rule that properly redirects all URLs in Tomcat 9 is:
RewriteRule ^/?(.*) https://server.url/$1 [R,NE,L]
Replacing server.url with the server's hostname.
Tomcat - redirect old context root to new context root
There is a Dir called ROOT
under tomcat/webapps
.
This ROOT "app" ends up getting invoked for those URLs that have "contextPath" different from the Directories under Webapps folder.
So you could:
Create folder called "oldappname" directly under the "ROOT" folder.
Create an index.html in that "oldappname" folder, and make it have a Javascript to Redirect Browser to the new URL.
Whenever the browser invokes http://servername/oldappname
, tomcat will render: webapps/ROOT/oldappname/index.html
UPDATE:
You could do some interesting things with ROOT:
Tomcat 6: How to change the ROOT application
https://tomcat.apache.org/tomcat-7.0-doc/config/context.html
Related Topics
How to Flip Images Horizontally with HTML5
HTML Image Not Showing in Gmail
How to Apply an Opacity Without Affecting a Child Element with HTML/Css
Fill Remaining Vertical Space - Only CSS
With a Browser, How to Know Which Decimal Separator Does the Operating System Use
CSS Only Animate Draw Circle with Border-Radius and Transparent Background
Restrict Future Dates in HTML5 Date Input
Declare Variable in a Play2 Scala Template
Options with Display:None Not Hidden in Ie
How to Get a Web Page Header/Footer Printed on Every Page
How to Choose Between Get and Post Methods in HTML Forms
Does a Name Attribute Have to Be Unique in a HTML Document
How Do Browsers Calculate Width When Child Depends on Parent, and Parent's Depends on Child'S
How to Completely Remove Borders from HTML Table
Is It Alright to Use Multiple H1 Tags on the Same Page, But Style Them Differently