Get 69% Off on Cloud Hosting : Claim Your Offer Now!
The word “www” which stands for the World Wide Web is an officially approved subdomain conventionally used to signify web locations. Whether it should be included or not in a URL or not depends on every individual or the strategic plan a business organization has on the side of branding. Thus, whereas some companies and organizations adhere to the use of ‘www’ since it has been widely used and appears more professional, others do not use it in order to use a more refined and more contemporary-looking appearance.
Whether or not to use “www” can affect a range of elements of any site, such as positioning, the general appearance of the site, and the branding image. For example, while it is possible to have a desktop version and a mobile version equally visible to visitors, this may deprive the site of proper redirection and result in problems with duplicate content which will negatively affect the rankings.
About the “www” prefix, the administrators can easily control it through configuration files such as ., Allows you to configure the Apache servers through the use of the .htaccess files or by configuring the server blocks of Nginx servers. Setting changes can also be made for domains so that they are correctly resolved; other systems, such as content management systems (CMS), may also need changes in settings to match the selected URL scheme.
Generally its use should be consistent and be backed by proper technical frameworks to enhance prospects of achieving the best outcomes in website resource dispensing. To go deeper, the following sections expose detailed procedures on how to add or remove the “www” prefix to your domain addresses.
If your server uses Apache, you can manage the "www" prefix by modifying the .htaccess file. This file allows you to configure redirection rules and other settings.
To Redirect from www to Non-www:
Add the following lines to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301]
To Redirect from Non-www to www:
Add these lines to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]
RewriteEngine On: Activates the mod_rewrite module.
RewriteCond: Specifies the condition for the rewrite rule.
RewriteRule: Defines the rule for rewriting the URL.
Note: Replace yourdomain.com with your actual domain name.
For servers using Nginx, you can adjust the server block configuration to handle the "www" prefix.
To Redirect from www to Non-www:
Include the following configuration in your Nginx settings:
server {
listen 80;
server_name www.yourdomain.com;
return 301 $scheme://yourdomain.com$request_uri;
}
To Redirect from Non-www to www:
Use the following configuration:
server {
listen 80;
server_name yourdomain.com;
return 301 $scheme://www.yourdomain.com$request_uri;
}
listen 80: Specifies the port (80 for HTTP).
server_name: Defines the domain name.
return 301: Performs a permanent redirect.
Note: Replace yourdomain.com with your actual domain name.
You can manage the "www" prefix through DNS settings, though this is more about ensuring proper resolution rather than redirection.
Add a CNAME Record:
To point www.yourdomain.com to yourdomain.com, add a CNAME record in your DNS settings:
Type: CNAME
Name: www
Value: yourdomain.com
Ensure A Record for Non-www:
Make sure there’s an A record for the non-www domain:
Type: A
Name: @ (or leave blank)
Value: Your server’s IP address
If you’re using a CMS, you might need to update settings to reflect your preference for the "www" prefix.
For a CMS:
Navigate to the General Settings or equivalent.
Update the Site URL and Home URL fields to include or exclude the "www" prefix as needed.
Note: Ensure that your server configuration matches the CMS settings to avoid redirection issues.
If your site uses HTTPS, ensure that your SSL certificate covers both the "www" and non-"www" versions of your domain. Update your redirection rules to handle both HTTP and HTTPS requests.
For Apache with HTTPS Redirection:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301]
For Nginx with HTTPS Redirection:
server {
listen 443 ssl;
server_name www.yourdomain.com;
return 301 https://yourdomain.com$request_uri;
}
If you revise something, make sure to test the site to see if redirects are going smoothly and there is no problem of redirecting from one page to another continuously or if some errors are being shown. Or you can use any website or browser extension/tools to make sure that all the redirects are working properly.
Dealing with the “www” prefix implies coordination of server settings, DNS records as well as CMS configurations. Following these steps, you will be able to make your domain always use or not use the “www” prefix as you desire. Managing these settings properly enhances the user experience, brings positive effects to SEO, and primarily leads the guests to the right version of the site.
Let’s talk about the future, and make it happen!
By continuing to use and navigate this website, you are agreeing to the use of cookies.
Find out more