I would like to redirect all requests, that coming to www.website.com/whatever
to the variant without www
.
How to do this in Rails & what is the best way to do that?
Asked
Active
Viewed 125 times
1

user984621
- 46,344
- 73
- 224
- 412
3 Answers
4
There are two options for this. If you want to do it within rails the following gem might be useful
https://github.com/iSabanin/www_ditcher
However, such tasks are generally configured from the app server. Please look at this question previously posted on stack overflow
301 redirect in Passenger (Ruby on Rails) from root domain to www sub domain?
It does the complement of what you seek to do, however it should get you on track. Thanks!

Community
- 1
- 1

sohaibbbhatti
- 2,672
- 22
- 21
3
I think it's best to keep the logic for that completely our of your Rails app and rather take care of it in the server configuration.