Lab Hack: Apache URI purgatory

To HTTP or to HTTPS, that is the question. This lab hack takes me deep into the domain.conf which controls all the VirtualHosts *:80 and VirtualHosts *:443 entries.

        RewriteEngine on
        RewriteCond %{HTTPS} off [OR]
        RewriteCond %{HTTP_HOST} !^www\. [NC]
        RewriteCond %{HTTP_HOST| ^(?:www\.)?(.+)$ [NC]
        RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]

This was the previous entry, lets cross our fingers that it works

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =www.draftfriend.com [OR]
        RewriteCond %{SERVER_NAME} =draftfriend.com
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

After a good restart of apache the test url target seemed to play nice. Food for thought.

RELATED POST

Virtual Machine Manager: Error starting domain

Starting up the KVM error occurred Error starting domain: Requested operation is not valid: network 'default' is not active Locate…

Git Commands

How to initialize a Git repo: Everything starts from here. The first step is to initialize a new Git repo…

Lab Hack: Raspberry Pi running VMWare ESXi

As strange as the title sounds, yes I am running VMWare ESXi on a Raspberry Pi 4 Model B (4GB)…

Lab Hack: Ubuntu openssh-server and passwordless authentication

While setting up the lab for a docker swarm training module I decided to spin up a few vms in…