nginx / unit

NGINX Unit - universal web app server - a lightweight and versatile open source server that simplifies the application stack by natively executing application code across eight different programming language runtimes.
https://unit.nginx.org
Apache License 2.0
5.27k stars 324 forks source link

Trailing slash rewrite - duplicated content SEO issue #1034

Closed sinedoOo closed 6 months ago

sinedoOo commented 6 months ago

Hello, I'm wondering how we can achieve trailing slash rewrite in Nginx Unit in case of PHP (Laravel) app? I need to return 301 redirect for all requests that ends with / to address without it. The purpose of it is to fight with duplicated content from SEO perspective.

In Nginx it can be achieved with one simple rewrite:

rewrite ^/(.*)/$ /$1 permanent;

How we can do it in case of Nginx Unit?