mirror of
https://github.com/Fechin/reference.git
synced 2026-11-20 21:23:11 +03:00
Update nginx rewrite rules for removing .html extension
This commit is contained in:
1 parent
c42b1a86cf
commit
28b8326003
1 file changed
+7
-5
+7
-5
@@ -35,12 +35,14 @@ http {
|
||||
# Rename cheatsheet
|
||||
rewrite ^/golang$ /go permanent;
|
||||
|
||||
# remove .html extension
|
||||
location / {
|
||||
if ($request_uri ~ ^/(.*)\.html) {
|
||||
return 302 /$1;
|
||||
}
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
try_files $uri $uri/ @html;
|
||||
}
|
||||
|
||||
location @html {
|
||||
# remove .html extension
|
||||
rewrite ^(.*)\.html$ $1 permanent;
|
||||
try_files $uri.html $uri/ =404;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user