Infinite Diaries Is Now Available via HTTPS / SSL—How to Properly Configure the .htaccess File

·

I switched Infinite Diaries over to HTTPS / SSL today, for a few simple reasons.

The first one is security—for example, if you’re on an iffy Wi-Fi connection, a third party will not be able to insert ads when you connect with my site. There are of course more geeky reasons, but I won’t go into them now. Secondly, I had this domain hooked up to Medium earlier, which didn’t pan out as you can tell1. The problem with this was that many people’s browsers remembered the previous HTTPS connection to Medium, and tried to force it, which resulted in a few issues, one of them not being able to connect without first clearing the browser’s complete history. I had a third reason, but I was distracted while writing this paragraph, so I’ll skip it for now.

Anyway, I wanted to focus on another matter. While the switch to SSL / HTTPS went about smoothly, I had a few issues with my .htaccess file configuration. The following code got all the redirects working correctly:

RewriteEngine On RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

The problem with the .htaccess file was such, that I found at least a dozen sites suggesting completely different configurations, none of which worked as intended. Oh and by the way, the 301 is there so search engines only index the HTTPS connections, skipping the non-secure ones.

Hopefully this will help someone out there.

  1. That’s a topic for another post.

Chcesz zwrócić mi na coś uwagę lub skomentować? Zapraszam na @morid1n.

One Comment