-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy path.htaccess
83 lines (70 loc) · 5 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
# Enable the rewrite engine
RewriteEngine On
# Enable case-sensitive matching
Options +SymLinksIfOwnerMatch
# Redirect any URL containing underscores to the same URL with hyphens, plus correcting the file with spaces
RewriteCond %{REQUEST_URI} ^/assets/deviated\ _drop-off\ _route.zip$
RewriteRule ^.*$ /assets/deviated-drop-off-route.zip [L,R=301]
RedirectMatch 301 "^(.*)_(.*)$" "$1-$2"
# Redirect rules using regex
RedirectMatch 301 ^/reference/static/?$ /documentation/schedule/reference/
RedirectMatch 301 ^/schedule/reference/?$ /documentation/schedule/reference/
RedirectMatch 301 ^/schedule/best-practices/?$ /documentation/schedule/schedule-best-practices/
RedirectMatch 301 ^/schedule/example-feed/?$ /getting-started/example-feed/
RedirectMatch 301 ^/schedule/examples/([^/]+)/?$ /documentation/schedule/examples/$1/
RedirectMatch 301 ^/schedule/examples/?$ /documentation/overview/
RedirectMatch 301 ^/schedule/changes/?$ /documentation/schedule/change-history/recent-additions/
RedirectMatch 301 ^/schedule/process/?$ /community/governance/gtfs-schedule-amendment-process/
RedirectMatch 301 ^/schedule/(validate|publishing)/?$ /getting-started/$1/
RedirectMatch 301 ^/realtime/best-practices/?$ /documentation/realtime/realtime-best-practices/
RedirectMatch 301 ^/realtime/feed-entities/?$ /documentation/realtime/feed-entities/overview/
RedirectMatch 301 ^/realtime/feed-entities/([^/]+)/?$ /documentation/realtime/feed-entities/$1/
RedirectMatch 301 ^/realtime/feed-examples/([^/]+)/?$ /documentation/realtime/examples/$1/
RedirectMatch 301 ^/realtime/feed-examples/?$ /documentation/overview/
RedirectMatch 301 ^/realtime/(proto|reference)/?$ /documentation/realtime/$1/
RedirectMatch 301 ^/realtime/changes/?$ /documentation/realtime/change-history/recent-additions/
RedirectMatch 301 ^/realtime/process/?$ /community/governance/gtfs-realtime-amendment-process/
RedirectMatch 301 ^/resources/community/?$ /community/get-involved/
RedirectMatch 301 ^/extensions/([^/]+)/?$ /community/extensions/$1/
RedirectMatch 301 ^/extensions/?$ /community/extensions/overview/
RedirectMatch 301 ^/blog/redirections-only/home/?$ /
RedirectMatch 301 ^/home/?$ /
RedirectMatch 301 ^/blog/redirections-only/(.*)$ /$1
# Language bindings redirects
RewriteRule ^realtime/language-bindings/?$ /documentation/realtime/language-bindings/overview/ [L,R=301]
RewriteRule ^realtime/language-bindings/(.*)$ /documentation/realtime/language-bindings/$1 [L,R=301]
# Specific redirects for /resources/, /realtime/, and /schedule/
RewriteRule ^resources/?$ /resources/overview/ [L,R=301]
RewriteRule ^realtime/?$ /documentation/overview/ [L,R=301]
RewriteRule ^schedule/?$ /documentation/overview/ [L,R=301]
# Redirect /realtime/ to /documentation/overview/ only if the URL is exactly /realtime/
RewriteCond %{REQUEST_URI} ^/realtime/$
RewriteRule ^realtime/$ /documentation/overview/ [L,R=301]
# Redirect /realtime/reference/ to /documentation/realtime/reference/ only if the URL is exactly /realtime/reference/
RewriteCond %{REQUEST_URI} ^/realtime/reference/$
RewriteRule ^realtime/reference/$ /documentation/realtime/reference/ [L,R=301]
# Anchor redirections
RewriteRule ^realtime/process/#guiding-principles https://gtfs.org/community/governance/gtfs-realtime-amendment-process/#guiding-principles [R=301,NE]
RewriteRule ^realtime/process/#revision-history https://gtfs.org/documentation/realtime/change-history/revision-history/ [R=301]
RewriteRule ^realtime/process/#experimental-fields https://gtfs.org/community/governance/gtfs-realtime-amendment-process/#experimental-fields [R=301,NE]
RewriteRule ^#why-use-gtfs https://gtfs.org/getting-started/why-use-GTFS/ [R=301]
RewriteRule ^#what-is-high-quality-gtfs https://gtfs.org/getting-started/validate/ [R=301]
RewriteRule ^schedule/#getting-started https://gtfs.org/getting-started/create/ [R=301]
RewriteRule ^schedule/#training-resources https://gtfs.org/resources/overview/ [R=301]
RewriteRule ^schedule/#getting-help-community https://gtfs.org/community/get-involved/ [R=301]
RewriteRule ^schedule/process/#guiding-principles https://gtfs.org/community/governance/gtfs-schedule-amendment-process/#guiding-principles [R=301,NE]
RewriteRule ^schedule/process/#revision-history https://gtfs.org/documentation/schedule/change-history/revision-history/ [R=301]
# Redirect any URL containing underscores to the same URL with hyphens, plus correcting the file with spaces
#RewriteCond %{THE_REQUEST} [_ ]
#RewriteRule ^([^_]*)[_ ]([^_]*)$ $1-$2 [N]
#RewriteRule ^(.*)[_ ](.*)$ $1-$2 [R=301,NC,L]
#RewriteCond %{THE_REQUEST} %20
#RewriteRule ^([^%]*?)%20([^%]*)$ $1-$2 [N]
#RewriteRule ^(.*?)%20(.*)$ $1-$2 [R=301,NC,L]
# Match any URL trying to access the blog in anything but EN and redirect them to EN
RewriteCond %{REQUEST_URI} ^/(?:fr|es|ja|ru|pt|ko|id|de|zh|zh-TW)/blog/
RewriteRule ^(.+?)/.+$ /blog/ [L,R=302]
# Match any URL under /ru, /pt, /ko, /id, /de, /zh, or /zh-TW and redirect to the corresponding index.html
RewriteCond %{REQUEST_URI} ^/(ru|pt|ko|id|de|zh|zh-TW)/
RewriteCond %{REQUEST_URI} !index\.html$
RewriteRule ^(.+?)/.+$ /$1/index.html [L,R=302]