From Boldcore's wiki
Revision as of 08:28, 31 December 2017 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Intro

This is very usefull, I meand, very important for all web servers.

www to non-www

Strange convention suggests to use www prefix before all domains. www.domain.com www.boldcore.eu

This is purely obsolete, resource, keypress, data and time wasting manner. Stop that !

http to https

Our friends from Google wants to protect our privacy, therefore, https-enabled websites have slightly higher Page-rank.

The code

<VirtualHost www.boldcore.eu:80>
 ServerName www.boldcore.eu
 ServerAlias www.boldcore.eu

RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

</VirtualHost>

<VirtualHost www.boldcore.eu:443>
 ServerName www.boldcore.eu
 ServerAlias www.boldcore.eu

RewriteEngine On
#RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
 
</VirtualHost>

<VirtualHost boldcore.eu:80>
 ServerName boldcore.eu
 ServerAlias boldcore.eu
 DocumentRoot /<whatever>

RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

</VirtualHost>