add 404
This commit is contained in:
1 parent
6addd97a93
commit
e355cb8f33
3 files changed
+89
-3
No files matched your search
+16
-3
@@ -12,7 +12,20 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
# Отдельная страница ошибки 404
|
||||
error_page 404 /404.html;
|
||||
|
||||
# Убираем .html из исходных запросов браузера
|
||||
if ($request_uri ~ ^(/[^?]*)\.html(\?.*)?$) {
|
||||
return 301 $1$is_args$args;
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
}
|
||||
|
||||
# Доступ только для внутренней обработки ошибки
|
||||
location = /404.html {
|
||||
internal;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user