Apache Virtual Host Linux PMC Tactical

Welcome to Apache Virtual Host Linux PMC Tactical.

If you are grateful for all the work PMC has done in the past 25 years, use Support PMC page.

Apache Virtual Host

Apache website config files are located in /etc/apache2/sites-available/ directory.

In this case I'm using fictional example.com website domain name.

Browse to that dir, then you could copy 000-default.conf file to example.com.conf or simply create brand new one and then copy-paste the following config/code block there:

<VirtualHost *:80>
DocumentRoot "/var/www/example.com"
ServerName example.com
ServerAlias www.example.com
<Directory "/var/www/example.com">
allow from all
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

When you create Letsencrypt SSL https domain config for your website domain, it will most likely complain about that RewriteCond/RewriteRule that its disabled because it might lead into never ending loop. I have no idea about that, I need to figure it out later :) PMCTODO