Redirect with nginx (remove substring from url)
问题 I want do a redirect from old url: http://example.org/xxxxxxxxx.html To new urls (remove ".html") http://example.org/xxxxxxxxx How I can do this with nginx? EDIT : xxxxxxxxx can be differ, example: http://example.org/url-1.html redirect to http://example.org/url-1 http://example.org/another-url.html redirect to http://example.org/another-url 回答1: location ~ ^(.*)\.html$ { return 301 $1; } 回答2: Probably you need a rewrite statement location /xxx.html { rewrite ^/xxx(.*) http://example.org