RACHEL DELONGE
FOR IMMEDIATE RELEASE
July 28, 2022
Forcing All Traffic To HTTPS
Earlier this month, we posted June 2022's traffic analysis. It was our first time reporting the figures with Awstats. Unfortunately, the numbers were significantly under reported. While we reported the HTTP traffic, about 40% of our traffic utilized our SSL site via HTTPS. After realizing the problem, we quickly decided to force all traffic to the SSL site, redirecting all traffic to HTTPS.
The numbers for June will be updated in the July 2022 report coming out next week. In the meantime, Kevin Tracy asked that we share the process for any other folks out there looking to use Awstats for their personal websites and wanting to force all web traffic on HTTPS.
How to Force HTTPS on All Web Traffic
STEP 1: Locate your .htaccess File
Most likely, you'll find this in the root directory in your FTP. Go ahead and download a copy of it on your computer. Once it's downloaded, open the copy.
STEP 2: Edit Your .htaccess File
.htaccess files are like vaginas. Everyone is unique in its own special way.
Take your time and look for a line of code that reads RewriteEngine On
Below that line of code, you'll want to add:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Once you've added the two lines of code, save your .htaccess file.
STEP 3: Overwrite The .htaccess File On Your FTP
The final step is to upload the new .htaccess file to your FTP. Once it's loaded, even if you type http://yoursite.com, the address will automagically change to the secure https://yoursite.com.
After that happens, if you use Awstats, all of your traffic will be reported in the SSL report for your domain.