server { server_name brandsatdoor.com; root /home/user/public_html; index index.html index.php; if ($request_uri ~* "^(.+)\.html(\?.*)?$") { return 301 $1/; } rewrite ^/([^/.]+[^/])$ /$1/ permanent; location / { try_files $uri $uri/ $uri.html =404; } location ~ /\.(ht|git|env) { deny all; } }