fix(nginx): redirect unknown paths to homepage
Drop the $uri/ directory step in try_files which triggered the default 403 page on directories without an index, and 302 any 403/404 back to /.
This commit is contained in:
@@ -4,7 +4,7 @@ server {
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri.html $uri/index.html $uri/index.htm $uri/ =404;
|
||||
try_files $uri $uri.html $uri/index.html $uri/index.htm =404;
|
||||
}
|
||||
|
||||
location /.well-known/ {
|
||||
@@ -13,11 +13,7 @@ server {
|
||||
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
||||
}
|
||||
|
||||
error_page 404 /404.html;
|
||||
location = /404.html {
|
||||
root /usr/share/nginx/html;
|
||||
internal;
|
||||
}
|
||||
error_page 403 404 =302 /;
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
|
||||
Reference in New Issue
Block a user