HostArmada Web Hosting Knowledge Base

Knowledge is power! Use that power and achieve total and unconditional control over the Web Hosting Services!

I want my domain to be accessible without www. How can I do that?

To www or not to www? This question has been a matter of debate for as long as the internet and websites exist. In the older internet days, when the web was young, people tended to use www as it identified their site as an actual page on the internet (WWW, meaning World Wide Web).

Why did this change

This concept has been long discarded as everything is moving toward simplification, and writing "www" or "http://" in the browser is no longer necessary. You can type in "domain.com", and you will be taken to the desired page immediately. Frankly, utilizing www or not is a complete matter of choice. There is no speed, performance, or security benefits to it. Some people believe that their URL appears more "pretty" when it has www attached to it while others prefer a more simplistic name, so they remove it.

How SEO changed the game

With the invention of virtual hosts, differents websites could be viewed on the same server with the same IP address. From an SEO standpoint, it started making sense to have a virtual host for the www version of your website, as some people naturally type "www" when entering domain names in their browser. If such a virtual host did not exist, a DNS error would appear for viewers who included "www" in the URL, harming the SEO of the site.

If you are a customer of HostArmada, you are in luck. We use cPanel on our infrastructure and, whenever a domain is added in the server’s DNS zone, a www CNAME record will be automatically created for it, keeping its online reputation intact. The CNAME record allows whoever types "www.yourdomain.com" in the browser to be redirected to your website, regardless of how you have configured it to work.

How to redirect your site to "non-www" using .htaccess

Now that this is all out of the way let's discuss how you can force a non-www redirection, no matter what your visitors type in the browser utilizing the .htaccess file. Here are the steps:

     1. Please navigate to your .htaccess file, either using the File Manager of the cPanel or SSH.
     2. Open the file for editing and place the following lines of code inside:

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

     and replace "exampledomain.com" with your actual domain name.

     3. Save the file and clear your browser's cache and your web application's cache if it is utilizing such.
     4. Refresh your browser or open your website, and it should be visible without www!

Note that this will ONLY WORK if the website is NOT URL SENSITIVE. Most open-source applications are domain sensitive and will open via the domain name that is defined within their configuration file or database, thus for them to start working without www, they need additional reconfiguration. Our technical team is 24/7 available at your disposal, so if you need assistance with this, do not hesitate to contact them. They are reachable via the ticking system in your Client Area.

Was this article useful and on point?

Find out more about HostArmada entire range of optimized Web Hosting Services and take action today on improving your website Loading Speed, Security, and overall Stability!