0
これは私の仮想ホストです。IPリクエスト(httpsまたはhttp)をdomine(https)にリダイレクトします
<VirtualHost *:80>
ServerName mywebsite
ServerAdmin [email protected]
DocumentRoot /var/www
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>
<VirtualHost *:443>
ServerName mywebsite
ServerAdmin [email protected]
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www>
Options +FollowSymlinks
AllowOverride all
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www
SetEnv HTTP_HOME /var/www
Satisfy Any
</Directory>
#ssl protocol
Protocols h2 http/1.1
SSLHonorCipherOrder on
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload"
SSLCertificateFile cert
SSLCertificateKeyFile cert2
SSLCertificateChainFile cert3
</VirtualHost>
この条件は、すべてのhttp要求をhttpsにリダイレクトします。例えばhttps://123.123.123.123/wordpress
からhttps://domine/wordpress または 123.123.123.123/wordpressに例 http://domine/wordpressため 私はドミネにIP要求をリダイレクトするための助けを必要とし、
123.123.123.123/wordpress https://domine/wordpress または https://123.123.123.123/wordpressには、 〜https://domine/wordpress
はい、 私の私の 'のRewriteRule^$ HTTPS(*)://%{HTTP_HOST}%{REQUEST_URI} [L、R = 301]' とするIPのための仕事のhttps:/ IP https:/ domineにはdomineを指定しますが、domineにはipを指定しないでください。 私はそれらのサーバにIPアドレス –
でアクセスしたくありません。私の回線を試してみてください。 –
良い仕事。 mywebsite%も指定しています%{HTTP_HOST}% –