hi
i’m running nginx with tomcat. I tried to rewrite all the incoming url
with /en appended. ex: www.example.com/main/index.html will get rewrite
to www.example.com/en/main/index.html
Following is my nginx config:
upstream www.example.com {
server localhost:8080;
}
location ^~ / {
index index.html index.htm;
rewrite ^ http://www.example.com/en$request_uri break;
}
location ^~ /en {
index index.html index.htm;
proxy_pass http://www.example.com/;
}
When i just do www.example.com/main/index.html, 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 “www.example.com/main/new” 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:
dir *.htm /en/* 404 /errors/503.htmany help is apprecaite.
Thank You
Steve Z.