-
Notifications
You must be signed in to change notification settings - Fork 15
/
.htaccess
59 lines (47 loc) · 2.54 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
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
### =============== Legacy redirects ===============
# Packages no longer exist
RewriteCond %{REQUEST_URI} ^(.*)en/.*/package-.*\.html [NC]
RewriteRule ^(.*)$ %1 [L,R=302]
# 2.x no longer exists
RewriteCond %{REQUEST_URI} ^(.*)en/2[.] [NC]
RewriteRule ^(.*)$ %1 [L,R=302]
# Redirect non-languaged minor versions to major version, e.g. /3.1/DataObject.html to /3/DataObject.html
RewriteCond %{REQUEST_URI} ^(.*)(\d)[.]\d/(.*)$ [NC]
RewriteRule ^(\d)\.\d/(.*)$ %1%2/%3 [L,R=302]
# Redirect language minor version to major version, e.g. /en/3.1/File.html to /3/File.html
RewriteCond %{REQUEST_URI} ^(.*)en/([\d]+)[.][\w.]+/(.*)$ [NC]
RewriteRule ^(.*)$ %1%2/%3 [L,R=302]
# Class redirect. E.g.
# /4/class-SilverStripe.AssetAdmin.Forms.FileSearchFormFactory.html
# /4/SilverStripe/AssetAdmin/Forms/FileSearchFormFactory.html
RewriteCond %{REQUEST_URI} ^(.*)([\w.]+)/class-([\w]+)\.html [NC]
RewriteRule ^(.*)$ %1%2/%3.html [L,R=302]
RewriteCond %{REQUEST_URI} ^(.*)([\w.]+)/class-([\w]+)\.([\w]+)\.html [NC]
RewriteRule ^(.*)$ %1%2/%3/%4.html [L,R=302]
RewriteCond %{REQUEST_URI} ^(.*)([\w.]+)/class-([\w]+)\.([\w]+)\.([\w]+)\.html [NC]
RewriteRule ^(.*)$ %1%2/%3/%4/%5.html [L,R=302]
RewriteCond %{REQUEST_URI} ^(.*)([\w.]+)/class-([\w]+)\.([\w]+)\.([\w]+)\.([\w]+)\.html [NC]
RewriteRule ^(.*)$ %1%2/%3/%4/%5/%6.html [L,R=302]
RewriteCond %{REQUEST_URI} ^(.*)([\w.]+)/class-([\w]+)\.([\w]+)\.([\w]+)\.([\w]+)\.([\w]+)\.html [NC]
RewriteRule ^(.*)$ %1%2/%3/%4/%5/%6/%7.html [L,R=302]
RewriteCond %{REQUEST_URI} ^(.*)([\w.]+)/class-([\w]+)\.([\w]+)\.([\w]+)\.([\w]+)\.([\w]+)\.([\w]+)\.html [NC]
RewriteRule ^(.*)$ %1%2/%3/%4/%5/%6/%7/%8.html [L,R=302]
### ============= End Legacy redirects =============
# Lookup script (used to be a SS app, now just a simple script)
# E.g. http://api.silverstripe.org.loc/search/lookup/?q=SilverStripe\ORM\HasManyList&version=4&module=framework
RewriteCond %{REQUEST_URI} ^(.*)search/lookup [NC]
RewriteRule ^/?search/lookup(/|$) %1search/lookup.php [L,R=302,QSA]
# Symlink to 5 index.html - default major version
RewriteCond %{REQUEST_URI} ^(.*)$ [NC]
RewriteRule ^/?$ %15/index.html [R=302,L]
# Serve docs in htdocs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} .* [NC]
RewriteRule ^(.*)$ htdocs/$1
# 404 handling
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* errors/404.html
</IfModule>