I would like to understand what the proper Nginx configuration is to redirect everything to http://example.com/ ... Namely:
Need to redirect to http://example.com/ automatically. How do I configure that?
I would like to understand what the proper Nginx configuration is to redirect everything to http://example.com/ ... Namely:
Need to redirect to http://example.com/ automatically. How do I configure that?
You can do something like this:
server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen 80;
server_name example.com;
<your other nginx settings>
}
server {
listen 443;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
listen 443;
server_name example.com;
return 301 http://example.com$request_uri;
}