Nginx config for www to non-www and non-www to www redirection

There are many ways to force Nginx to use either WWW version or non-WWW version of URLs for your site. We use following codes all the time. Redirect non-www to WWW Single domain server { server_name example.com; return 301 $scheme://www.example.com$request_uri; } All domains server { server_name “~^(?!www.).*” ; return 301 $scheme://www.$host$request_uri; } From WWW to…

TUTORIAL: How To Install Apache Web Server In CentOS 7.5 (1805) Linux In Amazon AWS Cloud With URL/HTTP/HTTPS Redirection

TUTORIAL: How to Install Apache Web Server in CentOS 7.5 (1805) Linux in Amazon AWS Cloud with URL/HTTP/HTTPS Redirection AUTHOR OF THIS TUTORIAL: MR. TURRITOPSIS DOHRNII TEO EN MING (ZHANG ENMING) @ TIME TRAVELLERAGE: 40 YEARS OLDCOUNTRY OF RESIDENCE: SINGAPOREDATE: 30TH AUGUST 2018 THURSDAYTIME: 10:49 AM SINGAPORE TIME Greenwich Mean Time+8 1. Sign up for…