Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Berlinger danielberlinger

View GitHub Profile
@danielberlinger
danielberlinger / robots.rb
Created Feb 4, 2010
Special case robots.txt as Rails Metal
View robots.rb
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class Robots
def self.call(env)
if env["PATH_INFO"] =~ /^\/robots.txt/
return disallow_multimedia if env["HTTP_HOST"] == 'www.something.biz' || env["HTTP_HOST"] =='something.biz'
return disallow_everything if env["HTTP_HOST"] =~ /\w*\.something.biz/
return disallow_everything if env["HTTP_HOST"] =~ /\w*\.somethingelse.com/
allow_everything