Skip to content

Instantly share code, notes, and snippets.

The goal is for any url elaposentoalto.upperroom.org/abc to be redirected to elaposentoalto.upperroom.org/es/abc
The following correctly redirects elaposentoalto.upperroom.org to elaposentoalto.upperroom.org/es, and it correctly leaves elaposentoalto.upperroom.org/es alone.
However, it incorrectly redirects elaposentoalto.upperroom.org/es/devotional to elaposentoalto.upperroom.org/es/es/devotional.
with_es_subdomains = ['elaposentoalto']
with_es_subdomains.each do |subdomain|
match "" => redirect("/es"), :constraints => { :subdomain => subdomain }
match "/*rest" => redirect("/es/%{rest}"), :constraints => lambda{ |req| req.host =~ /^#{subdomain}\./ && !(req.env["REQUEST_URI"] =~ /^es/) } "rentals"
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
@awebneck
awebneck / gist:1323260
Created October 28, 2011 19:35
controller
class @UserController extends Spine.Controller
constructor: ->
super
User.bind 'ajaxError', @handleSaveError
@render()
events:
'submit form': 'acquire'
render: (email, errors)->
@html @template
errors: errors

Keybase proof

I hereby claim:

  • I am awebneck on github.
  • I am awebneck (https://keybase.io/awebneck) on keybase.
  • I have a public key ASBXkU_U_aIwq8hZlxq1RJEX4zpBxNTYQ2PSa8X5f9wBIwo

To claim this, I am signing this object: