-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.ru
56 lines (40 loc) · 1.91 KB
/
config.ru
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
# encoding: utf-8
require File.expand_path("../rack_try_static", __FILE__)
require 'rack/rewrite'
use Rack::Rewrite do
# return true if request should be treated as going to a production server
def production_host?(rack_env)
!['www.tailgate32.com', 'tailgate32-staging.herokuapp.com', 'tailgate32-cedar-14-staging.herokuapp.com', 'localhost', '127.0.0.1'].include?(rack_env['SERVER_NAME'])
end
# Redirect everything to tailgate32.footballnation.com
r301 %r{.*}, 'http://www.tailgate32.com$&', :if => Proc.new {|rack_env|
production_host?(rack_env)
}
###########################################
############## Legacy Routes ##############
###########################################
# Use /episodes for the episode archive
r301 "/play", "/episodes"
r301 "/play.html", "/episodes"
# fix the querystring URL's for preloading an episode
# e.g. /play?episode=bal --> /play/bal
r301 %r{^/play[^?]*\?episode=(\w+)}, "/play/$1"
# links previously distributed to SI.com -- keep around so that those links don't break
r301 "/tailgate32-ep01", "http://www.youtube.com/embed/ctxN8gKQ_L8?vq=hd720&rel=0&showinfo=0"
r301 "/tailgate32-trailer", "http://www.youtube.com/embed/q3eWWvPwXEA?vq=hd720&rel=0&showinfo=0"
# for a short while we used /upcoming/hou instead of /events/hou
r301 %r{^/upcoming/(\w+)}, "/events/$1"
# we no longer have event pages, redirect to the episode itself
r301 %r{^/events/(\w+)}, "/play/$1"
# we don't have contests any longer
r301 %r{^/contests/*}, "/"
# redirect links to the schedule to the schedule B-Side
r301 %r{^/schedule*}, "/b-sides/schedule"
# REVVED UP trailer now goes to first episode
r301 %r{^/revved-up/the-trailer}, "/revved-up/this-is-revved-up"
end
use ::Rack::TryStatic,
:root => "build",
:urls => ["/"],
:try => [".html", "index.html", "/index.html"]
run lambda { [404, {"Content-Type" => "text/plain"}, ["File not found!"]] }