Skip to content

Commit e29df67

Browse files
authored
Redirect from path with html extension to base path (#6060)
Fixes #6055 by redirecting all links that end in `.html` to their base equivalent. This will also fix a few other 404s commonly seen in the analytics.
1 parent 60b5368 commit e29df67

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

firebase.json

+33-30
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
}
2929
],
3030
"redirects": [
31+
{ "regex": "(?P<basename>.*)\\.html$", "destination": ":basename", "type": 301 },
32+
{ "regex": "(?P<basename>.*)\\.$", "destination": ":basename", "type": 301 },
33+
3134
{ "source": "/+", "destination": "/community", "type": 301 },
3235
{ "source": "/+dart2js", "destination": "/tools/dart-compile#js", "type": 301 },
3336
{ "source": "/+isolates", "destination": "/language/concurrency", "type": 301 },
@@ -120,22 +123,22 @@
120123
{ "source": "/diagnostics/:code*", "destination": "/tools/diagnostic-messages?utm_source=dartdev&utm_medium=redir&utm_id=diagcode&utm_content=:code#:code", "type": 301 },
121124
{ "source": "/docs/api{,/**}", "destination": "https://api.dart.dev", "type": 301 },
122125
{ "source": "/docs/cookbook", "destination": "/language", "type": 301 },
123-
{ "source": "/docs/dart-up-and-running/**/ch02?(.html)", "destination": "/language", "type": 301 },
124-
{ "source": "/docs/dart-up-and-running/**/ch03?(.html)", "destination": "/libraries", "type": 301 },
125-
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart2js?(.html)", "destination": "/tools/dart-compile#js", "type": 301 },
126-
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart_analyzer?(.html)", "destination": "/tools/dart-analyze", "type": 301 },
127-
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dartium?(.html)", "destination": "/tools#editors", "type": 301 },
126+
{ "source": "/docs/dart-up-and-running/**/ch02", "destination": "/language", "type": 301 },
127+
{ "source": "/docs/dart-up-and-running/**/ch03", "destination": "/libraries", "type": 301 },
128+
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart2js", "destination": "/tools/dart-compile#js", "type": 301 },
129+
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart_analyzer", "destination": "/tools/dart-analyze", "type": 301 },
130+
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dartium", "destination": "/tools#editors", "type": 301 },
128131
{ "source": "/docs/dart-up-and-running{,/**}", "destination": "/resources/books", "type": 301 },
129132
{ "source": "/docs/editor", "destination": "/tools", "type": 301 },
130-
{ "source": "/docs/editor/getting-started?(.html)", "destination": "/overview", "type": 301 },
133+
{ "source": "/docs/editor/getting-started", "destination": "/overview", "type": 301 },
131134
{ "source": "/docs/getting-started{,/**}", "destination": "/overview", "type": 301 },
132135
{ "source": "/docs/language-tour", "destination": "/language", "type": 301 },
133136
{ "source": "/docs/library-tour", "destination": "/libraries", "type": 301 },
134137
{ "source": "/docs/pub-package-manager", "destination": "/tools/pub", "type": 301 },
135138
{ "source": "/docs/pub-package-manager/pubspec{,/**}", "destination": "/tools/pub/pubspec", "type": 301 },
136-
{ "source": "/docs/serverguide?(.html)", "destination": "/server", "type": 301 },
139+
{ "source": "/docs/serverguide", "destination": "/server", "type": 301 },
137140
{ "source": "/docs/spec/EnumsTC52draft.pdf", "destination": "/language/enum", "type": 301 },
138-
{ "source": "/docs/spec/deferred-loading?(.html)", "destination": "/language/libraries#lazily-loading-a-library", "type": 301 },
141+
{ "source": "/docs/spec/deferred-loading", "destination": "/language/libraries#lazily-loading-a-library", "type": 301 },
139142
{ "source": "/docs/spec{,/**}", "destination": "/guides/language/spec", "type": 301 },
140143
{ "source": "/docs/technical-overview{,/**}", "destination": "/overview", "type": 301 },
141144
{ "source": "/docs/tutorials/add-elements", "destination": "/library/dart-html", "type": 301 },
@@ -151,7 +154,7 @@
151154
{ "source": "/docs/tutorials/streams", "destination": "/libraries/async/using-streams", "type": 301 },
152155
{ "source": "/docs/tutorials{,/**}", "destination": "/tutorials", "type": 301 },
153156
{ "source": "/docs{,/**}", "destination": "/guides", "type": 301 },
154-
{ "source": "/downloads{,.html,/**}", "destination": "/get-dart", "type": 301 },
157+
{ "source": "/downloads{,/**}", "destination": "/get-dart", "type": 301 },
155158
{ "source": "/eclipse{,/**}", "destination": "/tools#editors", "type": 301 },
156159
{ "source": "/editor{,/**}", "destination": "/tools#editors", "type": 301 },
157160
{ "source": "/events/2015{,/**}", "destination": "https://www.youtube.com/watch?list=PLOU2XLYxmsIIQorIS8gagUiMau9S84vZV&v=FiXiI2Atexc", "type": 301 },
@@ -274,17 +277,17 @@
274277
{ "source": "/server/c-interop", "destination": "/interop/c-interop", "type": 301 },
275278
{ "source": "/server/google-cloud-platform{,/**}", "destination": "/server/google-cloud", "type": 301 },
276279
{ "source": "/server/io-library-tour", "destination": "/libraries/dart-io", "type": 301 },
277-
{ "source": "/server/tls-ssl?(.html)", "destination": "https://api.dart.dev/stable/dart-io/SecurityContext-class.html", "type": 301 },
280+
{ "source": "/server/tls-ssl", "destination": "https://api.dart.dev/stable/dart-io/SecurityContext-class.html", "type": 301 },
278281
{ "source": "/server/tools", "destination": "/tools", "type": 301 },
279282
{ "source": "/server/tools/dart-vm", "destination": "/tools/dart-run", "type": 301 },
280283
{ "source": "/stable{,/**}", "destination": "https://api.dart.dev/stable", "type": 301 },
281-
{ "source": "/support/faq?(.html)", "destination": "/resources/faq", "type": 301 },
284+
{ "source": "/support/faq", "destination": "/resources/faq", "type": 301 },
282285
{ "source": "/support{,/**}", "destination": "/community", "type": 301 },
283286

284287
{ "source": "/to/main-function", "destination": "/language/functions#main", "type": 301 },
285288

286289
{ "source": "/tools/**/download{,.html,/**}", "destination": "/get-dart", "type": 301 },
287-
{ "source": "/tools/**/private-files?(.html)", "destination": "/guides/libraries/private-files", "type": 301 },
290+
{ "source": "/tools/**/private-files", "destination": "/guides/libraries/private-files", "type": 301 },
288291
{ "source": "/tools/analyzer", "destination": "/tools/dart-analyze", "type": 301 },
289292
{ "source": "/tools/dart-pub", "destination": "/tools/pub/cmd", "type": 301 },
290293
{ "source": "/tools/dart-vm", "destination": "/tools/dart-run", "type": 301 },
@@ -296,30 +299,30 @@
296299
{ "source": "/tools/dartdocgen{,/**}", "destination": "/tools/dart-doc", "type": 301 },
297300
{ "source": "/tools/dartfix", "destination": "/tools/dart-fix", "type": 301 },
298301
{ "source": "/tools/dartfmt", "destination": "/tools/dart-format", "type": 301 },
299-
{ "source": "/tools/dartium?(.html)", "destination": "/tools#editors", "type": 301 },
302+
{ "source": "/tools/dartium", "destination": "/tools#editors", "type": 301 },
300303
{ "source": "/tools/dartpad/dartpad-best-practices", "destination": "https://doi.org/10.1145/3397537.3397558", "type": 301 },
301-
{ "source": "/tools/debian?(.html)", "destination": "/get-dart", "type": 301 },
304+
{ "source": "/tools/debian", "destination": "/get-dart", "type": 301 },
302305
{ "source": "/tools/docgen{,/**}", "destination": "/tools/dart-doc", "type": 301 },
303306
{ "source": "/tools/download-archive{,/**}", "destination": "/get-dart/archive", "type": 301 },
304-
{ "source": "/tools/download-editor?(.html)", "destination": "/tools", "type": 301 },
307+
{ "source": "/tools/download-editor", "destination": "/tools", "type": 301 },
305308
{ "source": "/tools/eclipse-plugin", "destination": "/tools#editors", "type": 301 },
306309
{ "source": "/tools/editor{,/**}", "destination": "/tools", "type": 301 },
307-
{ "source": "/tools/faq?(.html)", "destination": "/resources/faq", "type": 301 },
310+
{ "source": "/tools/faq", "destination": "/resources/faq", "type": 301 },
308311
{ "source": "/tools/observatory{,/**}", "destination": "/tools/dart-devtools", "type": 301 },
309312
{ "source": "/tools/pub", "destination": "/tools/pub/cmd", "type": 301 },
310-
{ "source": "/tools/pub/assets-and-*transformers?(.html)", "destination": "https://github.com/dart-lang/build", "type": 301 },
311-
{ "source": "/tools/pub/cmd/pub-build?(.html)", "destination": "/tools/webdev", "type": 301 },
312-
{ "source": "/tools/pub/cmd/pub-run?(.html)", "destination": "/tools/dart-run", "type": 301 },
313-
{ "source": "/tools/pub/cmd/pub-serve?(.html)", "destination": "/tools/webdev", "type": 301 },
314-
{ "source": "/tools/pub/cmd/pub-uploader?(.html)", "destination": "/tools/pub/publishing#uploaders", "type": 301 },
315-
{ "source": "/tools/pub/create-library-packages?(.html)", "destination": "/guides/libraries/create-packages", "type": 301 },
316-
{ "source": "/tools/pub/faq?(.html)", "destination": "/tools/faq#pub", "type": 301 },
317-
{ "source": "/tools/pub/get-started?(.html)", "destination": "/guides/packages", "type": 301 },
318-
{ "source": "/tools/pub/installing?(.html)", "destination": "/tools/pub/environment-variables", "type": 301 },
313+
{ "source": "/tools/pub/assets-and-*transformers", "destination": "https://github.com/dart-lang/build", "type": 301 },
314+
{ "source": "/tools/pub/cmd/pub-build", "destination": "/tools/webdev", "type": 301 },
315+
{ "source": "/tools/pub/cmd/pub-run", "destination": "/tools/dart-run", "type": 301 },
316+
{ "source": "/tools/pub/cmd/pub-serve", "destination": "/tools/webdev", "type": 301 },
317+
{ "source": "/tools/pub/cmd/pub-uploader", "destination": "/tools/pub/publishing#uploaders", "type": 301 },
318+
{ "source": "/tools/pub/create-library-packages", "destination": "/guides/libraries/create-packages", "type": 301 },
319+
{ "source": "/tools/pub/faq", "destination": "/tools/faq#pub", "type": 301 },
320+
{ "source": "/tools/pub/get-started", "destination": "/guides/packages", "type": 301 },
321+
{ "source": "/tools/pub/installing", "destination": "/tools/pub/environment-variables", "type": 301 },
319322
{ "source": "/tools/pub/transformers{,/**}", "destination": "https://github.com/dart-lang/build", "type": 301 },
320-
{ "source": "/tools/sdk/archive?(.html|.)", "destination": "/get-dart/archive", "type": 301 },
321-
{ "source": "/tools/webstorm?(.html)", "destination": "/tools#editors", "type": 301 },
322-
{ "source": "/tos@(|.htm|.html)", "destination": "/terms", "type": 301 },
323+
{ "source": "/tools/sdk/archive", "destination": "/get-dart/archive", "type": 301 },
324+
{ "source": "/tools/webstorm", "destination": "/tools#editors", "type": 301 },
325+
{ "source": "/tos", "destination": "/terms", "type": 301 },
323326
{ "source": "/tutorials/dart-vm", "destination": "/tutorials/server", "type": 301 },
324327
{ "source": "/tutorials/dart-vm/:page*", "destination": "/tutorials/server/:page*", "type": 301 },
325328
{ "source": "/tutorials/language", "destination": "/language", "type": 301 },
@@ -333,9 +336,9 @@
333336
{ "source": "/tutorials/web/low-level-html", "destination": "/web/get-started", "type": 301 },
334337
{ "source": "/tutorials/web/low-level-html/:rest*", "destination": "/libraries/dart-html", "type": 301 },
335338
{ "source": "/web-ui/observables{,/**}", "destination": "https://pub.dev/packages/observable", "type": 301 },
336-
{ "source": "/web/dart-2?(.html)", "destination": "/tools/webdev", "type": 301 },
339+
{ "source": "/web/dart-2", "destination": "/tools/webdev", "type": 301 },
337340
{ "source": "/web/js-interop", "destination": "/interop/js-interop", "type": 301 },
338-
{ "source": "/{docs,tools}/{pub-package-manager,pub/cmd,pub/tools/pub}/glossary?(.html)", "destination": "/tools/pub/glossary", "type": 301 }
341+
{ "source": "/{docs,tools}/{pub-package-manager,pub/cmd,pub/tools/pub}/glossary", "destination": "/tools/pub/glossary", "type": 301 }
339342
]
340343
},
341344
"emulators": {

src/content/404.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1>404</h1>
1212
<h2>Page not found</h2>
1313

1414
<div class="text-center content">
15-
<form action="/search.html" id="in-content-search">
15+
<form action="/search" id="in-content-search">
1616
<input type="hidden" name="cx" value="011220921317074318178:i4mscbaxtru">
1717
<input type="hidden" name="ie" value="UTF-8">
1818
<input type="hidden" name="hl" value="en">

0 commit comments

Comments
 (0)