Skip to content

Commit

Permalink
Redirect from path with html extension to base path (#6060)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
parlough authored Sep 5, 2024
1 parent 60b5368 commit e29df67
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 31 deletions.
63 changes: 33 additions & 30 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
}
],
"redirects": [
{ "regex": "(?P<basename>.*)\\.html$", "destination": ":basename", "type": 301 },
{ "regex": "(?P<basename>.*)\\.$", "destination": ":basename", "type": 301 },

{ "source": "/+", "destination": "/community", "type": 301 },
{ "source": "/+dart2js", "destination": "/tools/dart-compile#js", "type": 301 },
{ "source": "/+isolates", "destination": "/language/concurrency", "type": 301 },
Expand Down Expand Up @@ -120,22 +123,22 @@
{ "source": "/diagnostics/:code*", "destination": "/tools/diagnostic-messages?utm_source=dartdev&utm_medium=redir&utm_id=diagcode&utm_content=:code#:code", "type": 301 },
{ "source": "/docs/api{,/**}", "destination": "https://api.dart.dev", "type": 301 },
{ "source": "/docs/cookbook", "destination": "/language", "type": 301 },
{ "source": "/docs/dart-up-and-running/**/ch02?(.html)", "destination": "/language", "type": 301 },
{ "source": "/docs/dart-up-and-running/**/ch03?(.html)", "destination": "/libraries", "type": 301 },
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart2js?(.html)", "destination": "/tools/dart-compile#js", "type": 301 },
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart_analyzer?(.html)", "destination": "/tools/dart-analyze", "type": 301 },
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dartium?(.html)", "destination": "/tools#editors", "type": 301 },
{ "source": "/docs/dart-up-and-running/**/ch02", "destination": "/language", "type": 301 },
{ "source": "/docs/dart-up-and-running/**/ch03", "destination": "/libraries", "type": 301 },
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart2js", "destination": "/tools/dart-compile#js", "type": 301 },
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dart_analyzer", "destination": "/tools/dart-analyze", "type": 301 },
{ "source": "/docs/dart-up-and-running/contents/ch04-tools-dartium", "destination": "/tools#editors", "type": 301 },
{ "source": "/docs/dart-up-and-running{,/**}", "destination": "/resources/books", "type": 301 },
{ "source": "/docs/editor", "destination": "/tools", "type": 301 },
{ "source": "/docs/editor/getting-started?(.html)", "destination": "/overview", "type": 301 },
{ "source": "/docs/editor/getting-started", "destination": "/overview", "type": 301 },
{ "source": "/docs/getting-started{,/**}", "destination": "/overview", "type": 301 },
{ "source": "/docs/language-tour", "destination": "/language", "type": 301 },
{ "source": "/docs/library-tour", "destination": "/libraries", "type": 301 },
{ "source": "/docs/pub-package-manager", "destination": "/tools/pub", "type": 301 },
{ "source": "/docs/pub-package-manager/pubspec{,/**}", "destination": "/tools/pub/pubspec", "type": 301 },
{ "source": "/docs/serverguide?(.html)", "destination": "/server", "type": 301 },
{ "source": "/docs/serverguide", "destination": "/server", "type": 301 },
{ "source": "/docs/spec/EnumsTC52draft.pdf", "destination": "/language/enum", "type": 301 },
{ "source": "/docs/spec/deferred-loading?(.html)", "destination": "/language/libraries#lazily-loading-a-library", "type": 301 },
{ "source": "/docs/spec/deferred-loading", "destination": "/language/libraries#lazily-loading-a-library", "type": 301 },
{ "source": "/docs/spec{,/**}", "destination": "/guides/language/spec", "type": 301 },
{ "source": "/docs/technical-overview{,/**}", "destination": "/overview", "type": 301 },
{ "source": "/docs/tutorials/add-elements", "destination": "/library/dart-html", "type": 301 },
Expand All @@ -151,7 +154,7 @@
{ "source": "/docs/tutorials/streams", "destination": "/libraries/async/using-streams", "type": 301 },
{ "source": "/docs/tutorials{,/**}", "destination": "/tutorials", "type": 301 },
{ "source": "/docs{,/**}", "destination": "/guides", "type": 301 },
{ "source": "/downloads{,.html,/**}", "destination": "/get-dart", "type": 301 },
{ "source": "/downloads{,/**}", "destination": "/get-dart", "type": 301 },
{ "source": "/eclipse{,/**}", "destination": "/tools#editors", "type": 301 },
{ "source": "/editor{,/**}", "destination": "/tools#editors", "type": 301 },
{ "source": "/events/2015{,/**}", "destination": "https://www.youtube.com/watch?list=PLOU2XLYxmsIIQorIS8gagUiMau9S84vZV&v=FiXiI2Atexc", "type": 301 },
Expand Down Expand Up @@ -274,17 +277,17 @@
{ "source": "/server/c-interop", "destination": "/interop/c-interop", "type": 301 },
{ "source": "/server/google-cloud-platform{,/**}", "destination": "/server/google-cloud", "type": 301 },
{ "source": "/server/io-library-tour", "destination": "/libraries/dart-io", "type": 301 },
{ "source": "/server/tls-ssl?(.html)", "destination": "https://api.dart.dev/stable/dart-io/SecurityContext-class.html", "type": 301 },
{ "source": "/server/tls-ssl", "destination": "https://api.dart.dev/stable/dart-io/SecurityContext-class.html", "type": 301 },
{ "source": "/server/tools", "destination": "/tools", "type": 301 },
{ "source": "/server/tools/dart-vm", "destination": "/tools/dart-run", "type": 301 },
{ "source": "/stable{,/**}", "destination": "https://api.dart.dev/stable", "type": 301 },
{ "source": "/support/faq?(.html)", "destination": "/resources/faq", "type": 301 },
{ "source": "/support/faq", "destination": "/resources/faq", "type": 301 },
{ "source": "/support{,/**}", "destination": "/community", "type": 301 },

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

{ "source": "/tools/**/download{,.html,/**}", "destination": "/get-dart", "type": 301 },
{ "source": "/tools/**/private-files?(.html)", "destination": "/guides/libraries/private-files", "type": 301 },
{ "source": "/tools/**/private-files", "destination": "/guides/libraries/private-files", "type": 301 },
{ "source": "/tools/analyzer", "destination": "/tools/dart-analyze", "type": 301 },
{ "source": "/tools/dart-pub", "destination": "/tools/pub/cmd", "type": 301 },
{ "source": "/tools/dart-vm", "destination": "/tools/dart-run", "type": 301 },
Expand All @@ -296,30 +299,30 @@
{ "source": "/tools/dartdocgen{,/**}", "destination": "/tools/dart-doc", "type": 301 },
{ "source": "/tools/dartfix", "destination": "/tools/dart-fix", "type": 301 },
{ "source": "/tools/dartfmt", "destination": "/tools/dart-format", "type": 301 },
{ "source": "/tools/dartium?(.html)", "destination": "/tools#editors", "type": 301 },
{ "source": "/tools/dartium", "destination": "/tools#editors", "type": 301 },
{ "source": "/tools/dartpad/dartpad-best-practices", "destination": "https://doi.org/10.1145/3397537.3397558", "type": 301 },
{ "source": "/tools/debian?(.html)", "destination": "/get-dart", "type": 301 },
{ "source": "/tools/debian", "destination": "/get-dart", "type": 301 },
{ "source": "/tools/docgen{,/**}", "destination": "/tools/dart-doc", "type": 301 },
{ "source": "/tools/download-archive{,/**}", "destination": "/get-dart/archive", "type": 301 },
{ "source": "/tools/download-editor?(.html)", "destination": "/tools", "type": 301 },
{ "source": "/tools/download-editor", "destination": "/tools", "type": 301 },
{ "source": "/tools/eclipse-plugin", "destination": "/tools#editors", "type": 301 },
{ "source": "/tools/editor{,/**}", "destination": "/tools", "type": 301 },
{ "source": "/tools/faq?(.html)", "destination": "/resources/faq", "type": 301 },
{ "source": "/tools/faq", "destination": "/resources/faq", "type": 301 },
{ "source": "/tools/observatory{,/**}", "destination": "/tools/dart-devtools", "type": 301 },
{ "source": "/tools/pub", "destination": "/tools/pub/cmd", "type": 301 },
{ "source": "/tools/pub/assets-and-*transformers?(.html)", "destination": "https://github.com/dart-lang/build", "type": 301 },
{ "source": "/tools/pub/cmd/pub-build?(.html)", "destination": "/tools/webdev", "type": 301 },
{ "source": "/tools/pub/cmd/pub-run?(.html)", "destination": "/tools/dart-run", "type": 301 },
{ "source": "/tools/pub/cmd/pub-serve?(.html)", "destination": "/tools/webdev", "type": 301 },
{ "source": "/tools/pub/cmd/pub-uploader?(.html)", "destination": "/tools/pub/publishing#uploaders", "type": 301 },
{ "source": "/tools/pub/create-library-packages?(.html)", "destination": "/guides/libraries/create-packages", "type": 301 },
{ "source": "/tools/pub/faq?(.html)", "destination": "/tools/faq#pub", "type": 301 },
{ "source": "/tools/pub/get-started?(.html)", "destination": "/guides/packages", "type": 301 },
{ "source": "/tools/pub/installing?(.html)", "destination": "/tools/pub/environment-variables", "type": 301 },
{ "source": "/tools/pub/assets-and-*transformers", "destination": "https://github.com/dart-lang/build", "type": 301 },
{ "source": "/tools/pub/cmd/pub-build", "destination": "/tools/webdev", "type": 301 },
{ "source": "/tools/pub/cmd/pub-run", "destination": "/tools/dart-run", "type": 301 },
{ "source": "/tools/pub/cmd/pub-serve", "destination": "/tools/webdev", "type": 301 },
{ "source": "/tools/pub/cmd/pub-uploader", "destination": "/tools/pub/publishing#uploaders", "type": 301 },
{ "source": "/tools/pub/create-library-packages", "destination": "/guides/libraries/create-packages", "type": 301 },
{ "source": "/tools/pub/faq", "destination": "/tools/faq#pub", "type": 301 },
{ "source": "/tools/pub/get-started", "destination": "/guides/packages", "type": 301 },
{ "source": "/tools/pub/installing", "destination": "/tools/pub/environment-variables", "type": 301 },
{ "source": "/tools/pub/transformers{,/**}", "destination": "https://github.com/dart-lang/build", "type": 301 },
{ "source": "/tools/sdk/archive?(.html|.)", "destination": "/get-dart/archive", "type": 301 },
{ "source": "/tools/webstorm?(.html)", "destination": "/tools#editors", "type": 301 },
{ "source": "/tos@(|.htm|.html)", "destination": "/terms", "type": 301 },
{ "source": "/tools/sdk/archive", "destination": "/get-dart/archive", "type": 301 },
{ "source": "/tools/webstorm", "destination": "/tools#editors", "type": 301 },
{ "source": "/tos", "destination": "/terms", "type": 301 },
{ "source": "/tutorials/dart-vm", "destination": "/tutorials/server", "type": 301 },
{ "source": "/tutorials/dart-vm/:page*", "destination": "/tutorials/server/:page*", "type": 301 },
{ "source": "/tutorials/language", "destination": "/language", "type": 301 },
Expand All @@ -333,9 +336,9 @@
{ "source": "/tutorials/web/low-level-html", "destination": "/web/get-started", "type": 301 },
{ "source": "/tutorials/web/low-level-html/:rest*", "destination": "/libraries/dart-html", "type": 301 },
{ "source": "/web-ui/observables{,/**}", "destination": "https://pub.dev/packages/observable", "type": 301 },
{ "source": "/web/dart-2?(.html)", "destination": "/tools/webdev", "type": 301 },
{ "source": "/web/dart-2", "destination": "/tools/webdev", "type": 301 },
{ "source": "/web/js-interop", "destination": "/interop/js-interop", "type": 301 },
{ "source": "/{docs,tools}/{pub-package-manager,pub/cmd,pub/tools/pub}/glossary?(.html)", "destination": "/tools/pub/glossary", "type": 301 }
{ "source": "/{docs,tools}/{pub-package-manager,pub/cmd,pub/tools/pub}/glossary", "destination": "/tools/pub/glossary", "type": 301 }
]
},
"emulators": {
Expand Down
2 changes: 1 addition & 1 deletion src/content/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>404</h1>
<h2>Page not found</h2>

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

0 comments on commit e29df67

Please sign in to comment.