Skip to content

Instantly share code, notes, and snippets.

@sgruhier
Created May 16, 2010 17:03
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 sgruhier/403002 to your computer and use it in GitHub Desktop.
Save sgruhier/403002 to your computer and use it in GitHub Desktop.
URL for local sub-domains and/or locale from the domain name testing
If you want to test rails applications (or any web applications) locally with sub-domains and/or setting the locale
from the domain name as describe in Rails' guides
http://guides.rubyonrails.org/i18n.html#setting-the-locale-from-the-domain-name you have multiple options:
- Edit your /etc/hosts file, that sucks! you need admin access and you'll pollute. DO NOT DO THAT!
- Use passenger (and passenger pane if you are on Mac OS X), but you need to enter manually all aliases
in your apache/nginx config file. painfull
- use those URLs 127localhost.com and 127localhost.fr. DNS for all subdomains are setup to IP 127.0.0.1
Nothing to setup/modify locally, just:
- start your webserver ('./script/server' for rails 2 and 'rails s' for rails 3)
- and open your browser on
* http://127localhost.com:3000
* or http://127localhost.fr:3000
* or http://username.127localhost.fr:3000
* ...
I read something like this few months ago but I couldn't find the article neither remember the URL.
And it was only on .com so unusable for testing locale from the domain.
I hope those URLs (à la 37signals or 43things) are easier to remind :)
Happy testing
Seb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment