rewrite rule help.

Steve Zhuo lists at
Fri Apr 1 07:01:42 MSD 2011


i'm running nginx with tomcat.  I tried to rewrite all the incoming url
with /en appended. ex: will get rewrite

Following is my nginx config:

upstream   {
        server localhost:8080;

 location ^~ / {
            index  index.html index.htm;
            rewrite ^$request_uri break;

 location ^~ /en {
            index  index.html index.htm;

When i just do, it rewrites to the new
url and page shows.  But when i tried to write an url without .htm or
.html extension, the browser complains about page not found and return
404. such as ""  I got the 404 error on my
Tomcat log.  Before this rewrite rule, the page can be loaded without
any problem.

here is my tomcat config:


any help is apprecaite.

Thank You

Steve Zhuo

Posted via

More information about the nginx mailing list