mirror of https://github.com/MKRhere/wiki
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
379 B
22 lines
379 B
7 years ago
|
# nginx hacks and snippets
|
||
|
|
||
|
## Remove .html and rewrite urls
|
||
|
|
||
|
```text
|
||
|
server {
|
||
|
listen 80;
|
||
|
listen [::]:80;
|
||
|
root <root_dir>;
|
||
|
index index.html index.htm;
|
||
|
|
||
|
server_name <server_name>;
|
||
|
|
||
|
# rewrites .html to pretty urls
|
||
|
rewrite ^(/.+)\.html$ $scheme://$host$1 permanent;
|
||
|
|
||
|
location / {
|
||
|
index index.html index.htm;
|
||
|
try_files $uri.html $uri $uri/ @handler;
|
||
|
}
|
||
|
}
|
||
|
```
|