If you’re setting up a website, one common question is whether to use “www” in your domain — like www.example.com — or just go with the simpler example.com. The good news is: both will work. But choosing one and sticking with it improves server performance and overall stability of your hosting environment.
“www” stands for World Wide Web. Technically, it’s a subdomain, like blog.example.com or shop.example.com.Years ago, it was common to use “www”, but today many websites work without it.So, example.com and www.example.com can both point to the same website — but they are treated as separate server entries by routing systems unless configured properly.
If both versions of your site are accessible (with and without www), search engines might index both separately. That means split traffic, lower rankings, and potential confusion.
You just need to choose your preferred version (with or without www) and redirect the other to it. Here’s how.
If your hosting uses Apache (most shared hosting does), you can control redirects through the .htaccess file — a configuration file found in your website’s root folder.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Make sure
mod_rewrite
is enabled. You may need to ask your hosting provider.
If you want to control it through your DNS settings:
Note: DNS method does not redirect visitors — it just points traffic. To enforce redirection, use .htaccess or web server settings.
Most modern hosting panels let you set your preferred domain version via a dropdown. Look for something like: