Home Page Community Search Engine Optimization Forum SEO Checklist How to Create a www Site Version?

  • How to Create a www Site Version?

    Posted by H-educate on October 1, 2022 at 9:43 am

    Every website has a domain to run. To open the website, we type the link of the website which is usually domain.com (.com/.net/.org etc… depending on what you have chosen).

    Some websites open with the “www.”, while others don’t. Additionally, some opens with both cases. Don’t worry about enabling and disabling “www.”. It can be done easily by following a few steps, which we will discuss later in this article.

    What Does the www in a URL Mean?

    Some think that a domain will open whether you add www or not; however, this is not true. There is a difference between a URL having a www or not before your domain as www. acts as a subdomain or third-level domain. It was previously used to distinguish the link of the website from other elements like MAIL for an email server, FTP for an FTP server, etc…

    To ensure that your website works with www and without it, you should set up this feature.

    Why should you enable www. for your domain?

    Although it is not necessary to enable www. for your domain, doing it will be so helpful for your website for many reasons, including:

    1- Maximizing the website’s search performance.

    Many users still think that www. is associated with every link, so if they see your website name and wanna have a look, they will write www. before the name. Thus, by enabling it, you guarantee not losing a visitor.

    2- ِAvoid typing mistakes

    Those who usually type www. before each domain name may miss one or two letters. They may write w.domain.com or ww.domain.com. If you have already enabled with and without these letters, your website will open anyway.

    3- Help Google

    Enabling www is crucial for search engines. It tells Google that yourdomain.com and domain.com are the same site, so Google search engines can crawl both as one. website and not two distinct websites.

    You would never want Google to treat you as two websites with copied content.

    4- Better usage of cookies

    If you use cookies for tracking traffic to your website, you should enable www. When a visitor types domain.com, a cookie will be placed in his browser and it will be applied for any subdomain like help.domain.com, support.domain.com, and every other subdomain. This will make the tracking process very difficult.

    However, you will apply one cookie for each subdomain helping to track accurately the visitor’s performance.

    How to create a www Site Version?

    As said before, it is not a problem whether or not you use www. and it won’t affect your site loading. However, it is better to solve any possible scenario mentioned above.

    To create a www Site Version, you have to follow these steps:

    1- Go to your .htaccess file, and add this code:

    1

    RewriteEngine On

    2

    RewriteCond %{HTTP_HOST} ^example.com$

    3

    RewriteRule (.*) http://www.example.com$1 [R=301]

    It is not necessary to restart Apache after adding this code, however; you must make sure that Apache’s mod_rewrite module is enabled.

    2- Then go to Nginx, and add this code:

    1

    server {

    2

    server_name example.com;

    3

    return 301 http://www.example.com$request_uri;

    4

    }

    Now, just restart Nginx and complete working!

    How to remove www from your domain?

    To remove www from your domain, you have to follow these steps:

    1- Go to your .htaccess file, and add this code:

    1

    RewriteEngine On

    2

    RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]

    3

    RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

    It is not necessary to restart Apache after adding this code, however; you must make sure that Apache’s mod_rewrite module is enabled.

    2- Then go to Nginx, and add this code:

    1

    server {

    2

    server_name http://www.example.com;

    3

    return 301 http://example.com$request_uri;

    4

    }

    Congratulations, just restart Nginx and complete working!

    H-educate replied 1 month, 3 weeks ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Get 85% OFF on all our selected products
Get a Shocking Discount!
Check it out
Get a Shocking Discount!
Get 85% OFF on all our selected products
Check it out