fix(web/homepage): Fix redirect setup
- all www.* traffic -> non-www - redirect old blog entries without including the port
This commit is contained in:
parent
83e99b87e5
commit
1fa3316ca1
1 changed files with 8 additions and 1 deletions
|
@ -16,7 +16,7 @@ let
|
||||||
oldRedirects = lib.concatStringsSep "\n" (map (post: ''
|
oldRedirects = lib.concatStringsSep "\n" (map (post: ''
|
||||||
location ~* ^(/en)?/${post.oldKey} {
|
location ~* ^(/en)?/${post.oldKey} {
|
||||||
# TODO(tazjin): 301 once this works
|
# TODO(tazjin): 301 once this works
|
||||||
return 302 /blog/${post.key};
|
return 302 https://tazj.in/blog/${post.key};
|
||||||
}
|
}
|
||||||
'') (filter (hasAttr "oldKey") blog.posts));
|
'') (filter (hasAttr "oldKey") blog.posts));
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ let
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 8080 default_server;
|
listen 8080 default_server;
|
||||||
|
server_name tazj.in;
|
||||||
root ${website};
|
root ${website};
|
||||||
|
|
||||||
${oldRedirects}
|
${oldRedirects}
|
||||||
|
@ -58,6 +59,12 @@ let
|
||||||
try_files $uri $uri.html $uri/ =404;
|
try_files $uri $uri.html $uri/ =404;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 8080;
|
||||||
|
server_name www.tazj.in;
|
||||||
|
return 301 https://tazj.in$request_uri;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
in writeShellScriptBin "homepage" ''
|
in writeShellScriptBin "homepage" ''
|
||||||
|
|
Loading…
Add table
Reference in a new issue