Proper 410/404 pages
This commit is contained in:
27
nginx.conf
27
nginx.conf
@@ -108,6 +108,25 @@ http {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# 410 Gone: permanently removed URLs (tells crawlers to deindex)
|
||||
error_page 410 /410.html;
|
||||
location = /410.html {
|
||||
add_header Cache-Control "no-cache, must-revalidate";
|
||||
add_header Content-Type "text/html; charset=utf-8";
|
||||
}
|
||||
location = /2024/02/18/hello-world/ { return 410; }
|
||||
location = /2024/02/18/hello-world { return 410; }
|
||||
location = /pt/ { return 410; }
|
||||
location = /pt { return 410; }
|
||||
location = /feed/ { return 410; }
|
||||
location = /feed { return 410; }
|
||||
location = /category/uncategorized/feed/ { return 410; }
|
||||
location = /category/uncategorized/feed { return 410; }
|
||||
location = /category/uncategorized/ { return 410; }
|
||||
location = /category/uncategorized { return 410; }
|
||||
location = /comments/feed/ { return 410; }
|
||||
location = /comments/feed { return 410; }
|
||||
|
||||
# Allow .well-known (security.txt, ACME challenge, etc.)
|
||||
location ^~ /.well-known/ {
|
||||
add_header Cache-Control "public, max-age=86400";
|
||||
@@ -120,7 +139,11 @@ http {
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
# 404 falls back to index.html for SPA-style routing
|
||||
error_page 404 /index.html;
|
||||
# Custom 404 page (for missing static assets; SPA routes still try index.html first via try_files)
|
||||
error_page 404 /404.html;
|
||||
location = /404.html {
|
||||
add_header Cache-Control "no-cache, must-revalidate";
|
||||
add_header Content-Type "text/html; charset=utf-8";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user