For example:
- "domain.com" -> "www.domain.com"
- "domain.com/users" -> "www.domain.com/users"
I'm using Engine Yard and the nginx configuration files are there :
/data/nginx/servers
Here you can see DOMAIN.conf. Do not modify this file ! I did it and later I found out that my modification was removed. This happened when you "apply" or "upgrade" your environment, this file is re-created.
The file you should modify is /data/nginx/servers/DOMAIN/custom.conf
(If you look at the bottom of DOMAIN.conf, you can see that custom.conf is included)
Here is the code:
if ($host = domain.com) {
rewrite ^(.*) http://www.domain.com$1;
}
Then I was doing "touch tmp/restart.txt" and the redirection was not working...
Because in fact you should do this:
sudo /etc/init.d/nginx reload
Of course if you're using "https", you should modify "custom.ssl.conf" !