In this tutorial I will show you how to redirect non-www to www using htaccess file.
For example,
http://example.com
redirects to http://www.example.com
and https://example.com
redirects to https://www.example.com
# Redirect non-www to www RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Thanks for reading.