This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
/
.htaccess
127 lines (103 loc) · 5.78 KB
/
.htaccess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
Options -Indexes
DirectorySlash off
RewriteEngine on
RewriteOptions AllowNoSlash
<IfModule mod_expires.c>
ExpiresActive on
# Images
ExpiresByType image/png "access plus 7 days"
ExpiresByType image/jpg "access plus 7 days"
ExpiresByType image/jpeg "access plus 7 days"
ExpiresByType image/svg+xml "access plus 7 days"
# CSS, Javascript, HTML
ExpiresByType text/css "access plus 1 days"
ExpiresByType application/javascript "access plus 1 days"
ExpiresByType text/html "access plus 0 seconds"
# Web fonts
ExpiresByType application/font-woff "access plus 1 month"
</IfModule>
# Set default website version to old stable (v1.9.1)
RewriteCond %{REQUEST_URI} !^/versions/
RewriteCond %{HTTP_REFERER} !mxnet.apache.org
RewriteCond %{HTTP_REFERER} !mxnet.incubator.apache.org
RewriteCond %{HTTP_REFERER} !mxnet.cdn.apache.org
RewriteRule ^(.*)$ /versions/1.9.1/$1 [r=307,L]
# Redirect Chinese visitors to Chinese CDN, temporary solution for slow site speed in China
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CN$
RewriteCond %{HTTP_HOST} !cdn
RewriteRule ^(.*) https://mxnet.cdn.apache.org%{REQUEST_URI} [R,NC,L]
# Show file instead of folder for example /api/docs/tutorials.html
# instead of /api/docs/tutorials/
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*) $1.html [NC,L]
# Prettify some files like tutorials/io to tutorials/io.html
RewriteCond %{REQUEST_URI} !/julia/
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*) $1.html [NC,L]
#API docs needs specific root
RewriteCond %{REQUEST_URI} \/docs\/api$|\/docs\/tutorials$
RewriteRule ^(.*) %{REQUEST_URI}/ [R,NC,L]
# Prettify folders like /get_started
RewriteCond %{REQUEST_URI} !\/$
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/index.html -f
RewriteRule ^(.*) $1/index.html [NC,L]
# Redirect FAQ TODO: temporary fix for Github issue #18547
RewriteRule ^versions/master/faq/(.*)$ /api/faq/$1 [R,NC,L]
# 404
ErrorDocument 404 /404.html
# Redirects
# Python API
Redirect 301 /versions/master/api/python/index.html /api/python/docs/api/index.html
Redirect 301 /api/python/ndarray/ndarray.html /api/python/docs/api/ndarray/index.html
Redirect 301 /api/python/ndarray/random.html /api/python/docs/api/ndarray/random/index.html
Redirect 301 /api/python/ndarray/linalg.html /api/python/docs/api/ndarray/linalg/index.html
Redirect 301 /api/python/ndarray/contrib.html /api/python/docs/api/ndarray/contrib/index.html
Redirect 301 /api/python/ndarray/sparse.html /api/python/docs/api/ndarray/sparse/index.html
Redirect 301 /api/python/autograd/autograd.html /api/python/docs/api/autograd/index.html
Redirect 301 /api/python/gluon/gluon.html /api/python/docs/api/gluon/index.html
Redirect 301 /api/python/gluon/nn.html /api/python/docs/api/gluon/nn/index.html
Redirect 301 /api/python/gluon/rnn.html /api/python/docs/api/gluon/rnn/index.html
Redirect 301 /api/python/gluon/loss.html /api/python/docs/api/gluon/loss/index.html
Redirect 301 /api/python/gluon/data.html /api/python/docs/api/gluon/data/index.html
Redirect 301 /api/python/gluon/model_zoo.html /api/python/docs/api/gluon/model_zoo/index.html
Redirect 301 /api/python/gluon/contrib.html /api/python/docs/api/gluon/contrib/index.html
Redirect 301 /api/python/kvstore/kvstore.html /api/python/docs/api/kvstore/index.html
Redirect 301 /api/python/metric/metric.html /api/python/docs/api/metric/index.html
Redirect 301 /api/python/optimization/optimization.html /api/python/docs/api/optimizer/index.html
Redirect 301 /api/python/optimization/contrib.html /api/python/docs/api/optimizer/index.html
Redirect 301 /api/python/profiler/profiler.html /api/python/docs/api/mxnet/profiler/index.html
Redirect 301 /api/python/io/io.html /api/python/docs/api/mxnet/io/index.html
Redirect 301 /api/python/contrib/contrib.html /api/python/docs/api/contrib/index.html
Redirect 301 /api/python/symbol/symbol.html /api/python/docs/api/symbol/index.html
Redirect 301 /api/python/symbol.html /api/python/docs/api/symbol/index.html
Redirect 301 /api/python/symbol/linalg.html /api/python/docs/api/symbol/linalg/index.html
Redirect 301 /api/python/module/module.html /api/python/docs/api/module/index.html
Redirect 301 /api/python/callback/callback.html /api/python/docs/api/mxnet/callback/index.html
Redirect 301 /api/python/tools/visualization.html /api/python/docs/api/mxnet/visualization/index.html
Redirect 301 /api/python/executor/executor.html /api/python/docs/api/mxnet/executor/index.html
Redirect 301 /api/python/rtc/rtc.html /api/python/docs/api/mxnet/rtc/index.html
Redirect 301 /api/python/tools/test_utils.html /api/python/docs/api/mxnet/test_utils/index.html
# Top Level Nav bar
Redirect 301 /install/index.html /get_started
Redirect 301 /test/get_started/install.html /get_started
Redirect 301 /faq/index.html /api
Redirect 301 /tutorials/index.html /api
Redirect 301 /architecture/index.html /api/architecture/overview
Redirect 301 /community/ecosystem.html /ecosystem
Redirect 301 /community/powered_by.html /ecosystem