Answer the question
In order to leave comments, you need to log in
How to handle requests for subdomains in a Rails application?
For example, I want my website URL to look like blog.mysite.com. How can I achieve this in Ruby on Rails? I am using nginx server.
Answer the question
In order to leave comments, you need to log in
You can, for example, write lines like this in the server section of the nginx configuration:
server {
...
if ( $host != 'blog.mysite.com' ) {
rewrite ^/(.*)$ http://blog.mysite.com/$1 permanent;
}
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question