Ubuntu server 14.04.5 up to date, Apache, TransIP VPS
Ik ben voor het eerst bezig om onze websites van HTTP naar HTTPS om te zetten. Ik heb de benodigde certificaten en deze werken goed.
De www.example.nl.conf bestanden zijn/waren voor de HTTP websites als volgt;
Nu moet ik al het HTTP traffic naar HTTPS sturen en dan heb ik het dus zo
Dan werkt het allemaal goed. MAAR dan worden ALLE andere websites "example2.nl, example3.nl" etc., ook doorgestuurd (die nog gewoon HTTP zijn en pas straks/niet worden omgezet) naar https://example.nl.
Als ik de onderstaande code weghaal dan is dit niet meer het geval. Echter dan werkt de doorverwijzing van http://example naar https://example niet meer.
Het probleem zit waarschijnlijk in de code hierboven. Wat doe ik niet goed?
Ik ben voor het eerst bezig om onze websites van HTTP naar HTTPS om te zetten. Ik heb de benodigde certificaten en deze werken goed.
De www.example.nl.conf bestanden zijn/waren voor de HTTP websites als volgt;
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| # example.nl (/etc/apache2/sites-available/www.example.nl) # <VirtualHost *> ServerAdmin websites@example.nl ServerName www.example.nl ServerAlias example.nl # Indexes + Directory Root. DirectoryIndex index.php DocumentRoot /home/www/www.example.nl/htdocs/ # CGI Directory Alias /awstatsclasses "/usr/share/awstats/lib/" Alias /awstats-icon/ "/usr/share/awstats/icon/" Alias /awstatscss "/usr/share/doc/awstats/examples/css" ScriptAlias /awstats/ /usr/lib/cgi-bin/ ScriptAlias /cgi-bin/ /home/www/www.example.nl/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /home/www/www.example.nl/logs/error.log CustomLog /home/www/www.example.nl/logs/access.log combined </VirtualHost> |
Nu moet ik al het HTTP traffic naar HTTPS sturen en dan heb ik het dus zo
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| #NameVirtualHost *:80 #<VirtualHost *:80> # ServerName example.nl # ServerAlias www.example.nl # DocumentRoot /home/www/www.example.nl/htdocs/ # Redirect permanent / https://example.nl/ #</VirtualHost> <VirtualHost *:443> ServerAdmin websites@example.nl ServerName example.nl ServerAlias www.example.nl SSLEngine on SSLCertificateFile /etc/apache2/ssl/example.crt SSLCertificateKeyFile /etc/apache2/ssl/example.key SSLCACertificateFile /etc/apache2/ssl/examplecabundle.crt # Indexes + Directory Root. DirectoryIndex index.php DocumentRoot /home/www/www.example.nl/htdocs/ # CGI Directory Alias /awstatsclasses "/usr/share/awstats/lib/" Alias /awstats-icon/ "/usr/share/awstats/icon/" Alias /awstatscss "/usr/share/doc/awstats/examples/css" ScriptAlias /awstats/ /usr/lib/cgi-bin/ ScriptAlias /cgi-bin/ /home/www/www.example.nl/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /home/www/www.example.nl/logs/error.log CustomLog /home/www/www.example.nl/logs/access.log combined </VirtualHost> |
Dan werkt het allemaal goed. MAAR dan worden ALLE andere websites "example2.nl, example3.nl" etc., ook doorgestuurd (die nog gewoon HTTP zijn en pas straks/niet worden omgezet) naar https://example.nl.
Als ik de onderstaande code weghaal dan is dit niet meer het geval. Echter dan werkt de doorverwijzing van http://example naar https://example niet meer.
code:
1
2
3
4
5
6
7
| #NameVirtualHost *:80 #<VirtualHost *:80> # ServerName example.nl # ServerAlias www.example.nl # DocumentRoot /home/www/www.example.nl/htdocs/ # Redirect permanent / https://example.nl/ #</VirtualHost> |
Het probleem zit waarschijnlijk in de code hierboven. Wat doe ik niet goed?
APPLYitYourself.co.uk - APPLYitYourself.com - PLAKhetzelf.nl - Raamfolie, muurstickers en stickers - WindowDeco.nl Raamfolie op maat.