Skip to content

Benefits of Using WWW and Enforcing SSL

Published: at 09:59 PM

While modern web browsers and servers are flexible with domain formats and protocols, using the www subdomain and enforcing SSL (HTTPS) remain best practices for performance, scalability, and security.

Why “www” Was Originally Used

The www prefix stands for “World Wide Web” and was introduced in the early days of the internet to distinguish web services from other services like FTP or mail on the same domain.

Why Use “www” Today

Although technically optional, using www still offers several advantages:

Why Enforce SSL Across the Site

SSL (Secure Sockets Layer), now more accurately referred to as TLS (Transport Layer Security), encrypts the communication between a user’s browser and the web server. While it may seem sufficient to apply SSL only to pages that handle sensitive data (like login or payment pages), enforcing SSL site-wide is now considered a best practice.

Key Benefits:

Why SSL Should Be Used on All Pages

Enforcing SSL across the entire site ensures that every interaction is secure, consistent, and trusted by both users and search engines.

How to Implement WWW and Enforce SSL

On IIS (Internet Information Services)

  1. Redirect to www and HTTPS:

    • Open IIS Manager.
    • Select the site and click on HTTP Redirect.
    • Enable Only redirect requests to content in this directory.
    • Set the destination to https://www.example.com.
    • Check Only respond to requests to this site.
  2. Use URL Rewrite Module:

    • Install the URL Rewrite module if not already installed.
    • Add rules to redirect non-www and HTTP to https://www.example.com.

    Example rule:

    <rule name="Redirect to WWW and HTTPS" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" pattern="^example\.com$" />
        <add input="{HTTPS}" pattern="off" />
      </conditions>
      <action type="Redirect" url="https://www.example.com/{R:1}" redirectType="Permanent" />
    </rule>
    

On Apache

  1. Enable mod_rewrite:

    a2enmod rewrite
    
  2. Add to .htaccess or virtual host config:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example\.com [NC,OR]
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301]
    

ref: https://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www


Previous Post
Understanding SQL Server ID Jumps
Next Post
How to Block IP Addresses and Ranges in IIS and Apache