Email Round Trip Monitoring

If you administer an email server as I do, it's very useful to have an automated monitoring system that checks often that it works properly.

My first try on any new feature I want to add to my non-fatally-critical systems is to use an external service, specially if it can be done for free. Whereas there is a number of server monitoring services, most don't include roundtrip email monitoring, at least on their free plan. 

The only one I found to include it is...

Force HTTPS & www

You want to force any URL that doesn't include either:

  1. HTTPS
  2. www subdomain
to be redirected to the corresponding URL including both.

The following directives in the .htaccess file worked for me for a simple static site:

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

There must be a way to make the first condition generic and avoid hardcoding domain.com, I just didn't investigate it, maybe you already know how & can comment below ;-)