Created
July 21, 2011 17:44
-
-
Save nirix/1097737 to your computer and use it in GitHub Desktop.
Routing subdomains in Ramaze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Domains = { | |
/domain\.com/ => '/', | |
/forum\.domain\.com/ => '/forum/index' | |
} | |
Ramaze::Route['sub domains'] = lambda do |uri, action| | |
Domains.each do |regex, sub_uri| | |
if action['env']['HTTP_HOST'] =~ regex | |
return sub_uri | |
end | |
end | |
return uri | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment