Remove WWW Prefix in Domain URL

Add the following code in your web server configuration. This will remove www from domain site URL. If someone opened the site with www, this will redirect to non-www URL. Apache users add the following code in your website .htaccess file. This required the mod_rewrite enabled on your server, without mod_rewrite it will not work anymore. Nginx users add the following code in domains server block.

Adding WWW Prefix in Domain URL

Add the following code in your web server configuration. This will add www in domain site URL. If someone opened site without www, this will redirect to a domain with www URL. Apache users add the following code in your website .htaccess file. Remember to enable mod_rewrite module. Nginx users add the following code in domains server block. References: https://www.nginx.com/blog/creating-nginx-rewrite-rules/ http://httpd.apache.org/docs/current/mod/mod_rewrite.html