Skip to content

Instantly share code, notes, and snippets.

@awebneck
Forked from daniel-nelson/routes.rb
Created August 12, 2011 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awebneck/1142364 to your computer and use it in GitHub Desktop.
Save awebneck/1142364 to your computer and use it in GitHub Desktop.
no_es_subdomains = ['devotional']
no_es_subdomains.each do |subdomain|
match "/es" => redirect(""), :constraints => { :subdomain => subdomain }
match "/es/*path" => redirect("/%{path}"), :constraints => lambda{ |req| req.host =~ /^#{subdomain}\./ && !(req.env["REQUEST_URI"] =~ /^\/es/) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment