Skip to content

Instantly share code, notes, and snippets.

@traviskroberts
Last active August 29, 2015 14:22
Show Gist options
  • Save traviskroberts/739001cc5a3274f3da03 to your computer and use it in GitHub Desktop.
Save traviskroberts/739001cc5a3274f3da03 to your computer and use it in GitHub Desktop.
class Domain
def self.matches?(request)
request.domain.present? && request.domain != 'example.com'
end
end
MyApp::Application.routes.draw do
# domain routes (THIS IS THE IMPORTANT PART)
constraints(Domain) do
match '/' => 'user#show', :as => :user_domain
resources :tasks
resources :projects
# any other routes that are domain-specific
end
# this needs to be below the "domain" section
root :to => 'site#index'
end
<VirtualHost *:80>
DocumentRoot /path/to/my_app/public
<Directory /path/to/my_app/public>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment