nginx remove trailing slash only from domain code example Example: remove trailing slash from nginx rewrite ^/(.*)/$ /$1 permanent;