Skip to content

Commit 8d11036

Browse files
committed
redirect requests from eu to @
1 parent 80f34f5 commit 8d11036

File tree

6 files changed

+53
-25
lines changed

6 files changed

+53
-25
lines changed

eu/404.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
$uri = $_SERVER['REQUEST_URI'];
4+
5+
header('HTTP/1.1 301 Moved Permanently');
6+
header('Location: https://theunderminejournal.com' . $uri);

eu/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5+
<title>The Undermine Journal</title>
6+
<script type="text/javascript">
7+
(function(){
8+
var hash = location.hash;
9+
if (hash.substr(0,1) == '#') {
10+
hash = hash.substr(1);
11+
}
12+
hash = '#eu' + (hash != '' ? '/' + hash : '');
13+
location.href = '//theunderminejournal.com/' + location.search + hash;
14+
})();
15+
</script>
16+
</head>
17+
<body>
18+
The Undermine Journal EU has moved <a href="//theunderminejournal.com/#eu">here</a>.
19+
</body>
20+
</html>

eu/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
Disallow: /

incl/scripts.live.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
<link rel="shortcut icon" href="https://theunderminejournal.com/favicon.ico">
66
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
77
<script type="text/javascript" src="https://theunderminejournal.com/js/highcharts-custom.js"></script>
8-
<script type="text/javascript" src="https://theunderminejournal.com/js/main.js?7"></script>
8+
<script type="text/javascript" src="https://theunderminejournal.com/js/main.js?8"></script>
99
<script type="text/javascript" src="https://wowjs.zamimg.com/widgets/power.js"></script>
1010
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

lighttpd.conf/newsstand.conf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,19 @@ $HTTP["host"] =~ "^www\.theunderminejournal\.com" {
3535
url.redirect = ( "^/(.*)" => "https://theunderminejournal.com/$1" )
3636
}
3737

38-
$HTTP["host"] =~ "^(eu\.|local\.)?theunderminejournal\.com$|^newsstand$" {
38+
$HTTP["host"] =~ "^eu\.theunderminejournal\.com$" {
39+
var.server_name = "%0"
40+
41+
server.name = server_name
42+
server.document-root = "/var/newsstand/eu"
43+
server.error-handler-404 = "/404.php"
44+
45+
$HTTP["url"] =~ "^/TheUndermineJournal.zip" {
46+
url.redirect = ( "^/TheUndermineJournal.zip" => "https://addon.theunderminejournal.com/TheUndermineJournal.zip" )
47+
}
48+
}
49+
50+
$HTTP["host"] =~ "^theunderminejournal\.com$|^newsstand$" {
3951
var.server_name = "%0"
4052

4153
server.name = server_name

public/js/main.js

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -569,20 +569,22 @@ var TUJ = function ()
569569
var searchRealm;
570570
if (searchRealm = /^\?realm=([AH])-([^&]+)/i.exec(decodeURIComponent(location.search))) {
571571
ls = {};
572-
var guessRegion = (location.hostname.substr(0,3) == 'eu.') ? 1 : 0;
573-
for (var x in tuj.realms[guessRegion]) {
574-
if (tuj.realms[guessRegion][x].name.toLowerCase() == searchRealm[2].toLowerCase()) {
575-
ls.realm = tuj.realms[guessRegion][x].id;
572+
var guessRegion = self.params.region == undefined ? 0 : self.params.region;
573+
for (var x in tuj.allRealms[guessRegion]) {
574+
if (tuj.allRealms[guessRegion][x].name.toLowerCase() == searchRealm[2].toLowerCase()) {
575+
ls.realm = tuj.allRealms[guessRegion][x].id;
576576
ls.region = guessRegion;
577577
}
578578
}
579579

580-
inMain = false;
581-
tuj.SetParams(ls);
582-
return;
580+
if (ls.hasOwnProperty('realm')) {
581+
inMain = false;
582+
tuj.SetParams(ls);
583+
return;
584+
}
583585
}
584586

585-
if ((ls = libtuj.Storage.Get('defaultRealm')) && ls.hasOwnProperty('region')) {
587+
if (self.params.region == undefined && (ls = libtuj.Storage.Get('defaultRealm')) && ls.hasOwnProperty('region')) {
586588
var url = location.protocol + '//' + location.hostname + '/';
587589
if (!(document.referrer && document.referrer.substr(0, url.length) == url)) {
588590
inMain = false;
@@ -596,20 +598,6 @@ var TUJ = function ()
596598
location.href = location.pathname + location.hash;
597599
}
598600
}
599-
if (location.hostname.substr(0,3) == 'eu.') {
600-
inMain = false;
601-
var rln = undefined;
602-
if (self.params.realm) {
603-
for (var x in self.allRealms[1]) {
604-
if (self.allRealms[1][x].name == self.realms[self.params.realm].name) {
605-
rln = x;
606-
break;
607-
}
608-
}
609-
}
610-
location.href = '//'+location.hostname.substr(3)+'/'+self.BuildHash({region: 1, realm: rln});
611-
return;
612-
}
613601

614602
UpdateSidebar();
615603

@@ -708,7 +696,7 @@ var TUJ = function ()
708696
}
709697
}
710698
if (gotRegion == -2) {
711-
p.region = (location.hostname.substr(0,3) == 'eu.') ? 1 : 0;
699+
p.region = 0;
712700
if (self.params.region != undefined) {
713701
p.region = self.params.region;
714702
gotRegion = -1;

0 commit comments

Comments
 (0)