Remove trailing slash from URL

Nginx

Avoid duplicate content in your website analytics by removing the trailing slash from URL using Nginx

text

rewrite ^/(.*)/$ /$1 permanent; # Example server { listen 80; server_name www.mysite.com; rewrite ^/(.*)/$ /$1 permanent; }