Question

I have a rails application hosted on engineyard cloud using unicorn web server stack. I am trying to remove www from the site url but still have no luck. I used to provide RewriteRule in .htaccess for my apache application but I am not sure about unicorn/nginx.

Was it helpful?

Solution

This will redirect any requests for http://www.abc.de to http://abc.de:

server {
  server_name www.abc.de;
  rewrite ^/(.*) http://abc.de/$1 permanent;
}

server {
  server_name abc.de;
  # rest of the config goes here
}

You'd normally put this in your vhost config at /etc/nginx/sites-available/site_name; the equivalent on EngineYard appears to be /etc/nginx/servers/app_name/custom.conf, but don't quote me on that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top