I am using nginx on Rackspace cloud following a tutorial and having searched the net and so far can\'t get this sorted.
I want www.mysite.com to go to mysite.com as
try this
if ($host !~* ^www\.){
rewrite ^(.*)$ https://www.yoursite.com$1;
}
Other way: Nginx no-www to www
server {
listen 80;
server_name yoursite.com;
root /path/;
index index.php;
return 301 https://www.yoursite.com$request_uri;
}
and www to no-www
server {
listen 80;
server_name www.yoursite.com;
root /path/;
index index.php;
return 301 https://yoursite.com$request_uri;
}