Last active
April 14, 2018 17:58
-
-
Save mattclements/47446c5eb1fc9b6eff9f to your computer and use it in GitHub Desktop.
Apache VHOST File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServerName [% vhost.servername %] | |
[% IF vhost.serveralias_array.size -%] | |
[% FOREACH alias IN vhost.serveralias_array -%] | |
ServerAlias [% alias %] | |
[% IF alias == 'www.' _ vhost.servername -%] | |
RewriteCond %{HTTPS} !=on | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
[% END -%] | |
[% END -%] | |
[% ELSE -%] | |
ServerAlias [% vhost.serveralias %] | |
[% IF vhost.serveralias == 'www.' _ vhost.servername -%] | |
RewriteCond %{HTTPS} !=on | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
[% END -%] | |
[% END -%] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment