This simple guide will show you how to show www or remove www from your domain name using a .htaccess file. (your server must be using apache server)

If you would like to display www.

Create a .htaccess file and place it in your website root directroy
Copy this code

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-website\.com
RewriteRule (.*) http://www.your-website.com/$1 [R=301,L]
If you would like to remove www.

Create a .htaccess file and place it in your website root directroy
Copy this code

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.your-website\.com
RewriteRule (.*) http://your-website.com/$1 [R=301,L]