Add trailing slash redirect rule in nginx.conf to standardize URLs
This commit is contained in:
@@ -13,6 +13,11 @@ http {
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
|
# Automatically redirect URLs missing trailing slash (but not files like .js, .css, etc.)
|
||||||
|
if ($request_uri ~ ^([^.\?\#]*[^/])$) {
|
||||||
|
return 301 $request_uri/;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://main-website:3000;
|
proxy_pass http://main-website:3000;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|||||||
Reference in New Issue
Block a user