Skip to content

Commit 2de567e

Browse files
authored
Merge pull request #3894 from ruby/fix-preview-redirect
Use relative redirect for non-production environments
2 parents 8e18754 + 531d897 commit 2de567e

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

index.html

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,11 @@
2424
var language = languages[code];
2525
if (!language) { language = "en"; }
2626

27-
// If we're running on localhost/loopback for local development,
28-
// keep redirects relative so the developer can test locally.
2927
var host = window.location.hostname;
30-
var isLocal = (host === 'localhost' || host === '127.0.0.1' || host === '::1');
31-
if (isLocal) {
32-
document.location = "/" + language + "/";
33-
} else {
28+
if (host === 'www.ruby-lang.org') {
3429
document.location = "https://www.ruby-lang.org/" + language + "/";
30+
} else {
31+
document.location = "/" + language + "/";
3532
}
3633
</script>
3734
<noscript>

0 commit comments

Comments
 (0)