redirect.conf 1.69 KB
Newer Older
Daniel Juarez's avatar
Daniel Juarez committed
1
2
# Redirect slc4 and slc5 to old website
location /linux/scientific4/ {
Daniel Juarez's avatar
Daniel Juarez committed
3
    rewrite ^/(.*)$ $scheme://linux-old.web.cern.ch/$1 permanent;
Daniel Juarez's avatar
Daniel Juarez committed
4
5
6
}

location /scientific4/ {
Daniel Juarez's avatar
Daniel Juarez committed
7
    rewrite ^/(.*)$ $scheme://linux-old.web.cern.ch/linux-old/$1 permanent;
Daniel Juarez's avatar
Daniel Juarez committed
8
9
10
}

location /scientific4 {
Daniel Juarez's avatar
Daniel Juarez committed
11
    return 301 $scheme://linux-old.web.cern.ch/linux-old/scientific4;
Daniel Juarez's avatar
Daniel Juarez committed
12
13
14
}

location /linux/scientific5/ {
Daniel Juarez's avatar
Daniel Juarez committed
15
    rewrite ^/(.*)$ $scheme://linux-old.web.cern.ch/$1 permanent;
Daniel Juarez's avatar
Daniel Juarez committed
16
17
18
}

location /scientific5/ {
Daniel Juarez's avatar
Daniel Juarez committed
19
    rewrite ^/(.*)$ $scheme://linux-old.web.cern.ch/linux-old/$1 permanent;
Daniel Juarez's avatar
Daniel Juarez committed
20
21
22
}

location /scientific5 {
Daniel Juarez's avatar
Daniel Juarez committed
23
    return 301 $scheme://linux-old.web.cern.ch/linux-old/scientific5;
24
25
26
27
}

# Redirect slc6 to archive website
location /linux/scientific6/ {
Daniel Juarez's avatar
Daniel Juarez committed
28
    rewrite ^/(.*)$ $scheme://linux-archive.web.cern.ch/$1 permanent;
29
30
31
}

location /scientific6 {
Daniel Juarez's avatar
Daniel Juarez committed
32
    rewrite ^/(.*)$ $scheme://linux-archive.web.cern.ch/$1 permanent;
33
34
35
}

location /updates/slc6/ {
Daniel Juarez's avatar
Daniel Juarez committed
36
    rewrite ^/(.*)$ $scheme://linux-archive.web.cern.ch/$1 permanent;
Daniel Juarez's avatar
Daniel Juarez committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
}

# Keep linux.web.cern.ch/linux/path urls working, redirecting to ommit the /linux/ part
location = /linux {
    return 301 /;
}

location /linux/ {
    rewrite /linux/(.*) /$1 permanent;
}

# linux.web.cern.ch/path/index.shtml should now redirect to linux.web.cern.ch/path/
if ($request_uri ~ ^/(.*)\index.shtml$) {
    return 302 /$1;
}

# linux.web.cern.ch/path/any.shtml should now redirect to linux.web.cern.ch/path/any/
if ($request_uri ~ ^/(.*)\.shtml$) {
    return 302 /$1;
}

try_files $uri $uri.shtml $uri/ =404;

## Don't show the nginx version number, a security best practice
server_tokens off;

63
# Use our custom 40X page, a simple copypaste from theme's 404
Daniel Juarez's avatar
Daniel Juarez committed
64
error_page  403              /403.html;
65
error_page  404              /404.html;