Search Our Database

How to Add WWW to Your Website Using .htaccess?

Last updated on |
by

Certain websites have www displayed in their URL, and some do not. It makes no real difference whether you choose to add www in front of your website, or not, aside from cosmetic reasons.

Editing the .htaccess File

Open or create a new file .htaccess in public_html with content as sample below:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]