https://www. domain .com を https:// domain .com に 301 で変換します。
ドメイン .com の証明書はありますが、www のワイルドカードはありません。ドメイン .com.
私は次のことを試しました:
RewriteEngine On
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^www\.meinedomain\.de$ [NC]
RewriteRule ^(.*) https://meinedomain.de/$1 [L,R=301]
と
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
と
Redirect 301 / https://mineyourmind.de/
これはどれも機能しません。何が間違っている可能性がありますか?これを apache 設定に直接追加したところ、http://www. domain .com および http:// domain .com を https:// domain .com に変換しますが、https:// www には変換しません。ドメイン .com.
現時点では、次の構成を使用しています。https://www.mineyourmind.deからhttps://mineyourmind.deへの代わりに、すべての redrict が正常に機能します。
そのようなファイルはどのように見えるべきですか?
<VirtualHost *:80>
ServerName mineyourmind.de
ServerAlias www.mineyourmind.de
Redirect 301 / https://mineyourmind.de/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin **
DocumentRoot /var/www/mineyourmind
ServerName mineyourmind.de
ServerAlias www.mineyourmind.de
SSLEngine on
SSLCertificateFile /etc/**
SSLCertificateKeyFile /etc/**
SSLCertificateChainFile /etc/**
SSLCACertificateFile /etc/**
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
deny from all
</Directory>
<Directory /var/www/mineyourmind/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
2番目の編集:
<VirtualHost *:80>
ServerName mineyourmind.de
ServerAlias www.mineyourmind.de
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.mineyourmind\.de$ [NC]
RewriteRule (.*) https://mineyourmind.de%{REQUEST_URI} [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin **
DocumentRoot /var/www/mineyourmind
ServerName mineyourmind.de
ServerAlias www.mineyourmind.de
SSLEngine on
SSLCertificateFile /etc/apache2/**
SSLCertificateKeyFile /etc/apache2/ssl/**
SSLCertificateChainFile /etc/apache2/ssl/**
SSLCACertificateFile /etc/apache2/ssl/**
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\.mineyourmind\.de$ [NC]
RewriteRule (.*) https://mineyourmind.de%{REQUEST_URI} [R=301,L]
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
deny from all
</Directory>
<Directory /var/www/mineyourmind/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>