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.

What is “www”?

“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.

Problem: Duplicate Content & SEO Issues

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.

Solution: Redirect One Version to the Other

You just need to choose your preferred version (with or without www) and redirect the other to it. Here’s how.

Option 1: Redirect using .htaccess (Apache Servers)

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.

Redirect to www:

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

 Redirect to non-www:

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.

Option 2: Use DNS Records

If you want to control it through your DNS settings:

  • Make sure both www.example.com and example.com are pointing to the same IP address.
  • Use a CNAME to point www to the root domain (example.com), or vice versa.

Note: DNS method does not redirect visitors — it just points traffic. To enforce redirection, use .htaccess or web server settings.

 Option 3: Configure through Hosting Panel (cPanel, DirectAdmin, etc.)

Most modern hosting panels let you set your preferred domain version via a dropdown. Look for something like:

  • “Redirect www to non-www”
  • or “Force www version”

 Final Tips

  • Pick one version — with or without “www” — and stick with it.
  • Set your preferred domain in Google Search Console.
  • Test redirects using tools like httpstatus.io.