Tomcat rewrite Valve - rewrite.config examples


Does anyone know examples on how to do rewrites for removing:




Tomcat’s rewrite valve syntax is quite similar to Apache’s Mod_Rewrite so most examples for it will carry over with little to no change.

For example, you can remove index.cfm like so:

RewriteRule ^(.*)$ index.cfm/$1


Hi thanks. So I have rewrite.config in ROOT/WEB-INF and put in: RewriteRule ^(.*)$ index.cfm/$1
Restarted Lucee.
Then I go to and get…

It should be easy but why is it not working…

Added in Tomcat context.xml: <Valve className="org.apache.catalina.valves.rewrite.RewriteValve" />

Now getting website without css and links not working, somethings going on, but not there yet.


You may need to include this prior to the index.cfm rewrite to ignore assets like CSS etc…

RewriteCond %{REQUEST_URI} !^.*\.(bmp|css|gif|htc|html?|ico|jpe?g|js|pdf|png|swf|txt|xml|svg|eot|woff|woff2|ttf)$


Mmm no luck, now every link I click shows the link in the browser but only the index.cfm page!

I really wish there was some kind off extension for this for Lucee.

Not motivating at all! :nauseated_face:


@MvdO if you want turn-key rewrites, just start your servers with CommandBox. It’s built in and also supports the mod_rewrite config syntax.

server start --rewritesEnable

That will do the basic translation of \



So yes, that’s better, now I can read up on rewrites in the commandbox docs, cheers!