Get $50+ off for Black Friday!

We've moved discussions to Discord

Ngnix configuration to always use www

Ugurcan Kaya •
What would be the best way to redirect the domain to www only? Server level or at Rails?

If server, what is the ngnix code that can do that?
Chris Oliver •
Always on NGINX because it's way faster.

Tons of examples on Google, for example:

server {
    listen 80;
    server_name yourdomain.com;

    return 301 $scheme://www.yourdomain.com$request_uri;
}
Ugurcan Kaya •
 👍  👍   
Notifications
You’re not receiving notifications from this thread.