AWS ELB HTTPS重定向Wordpress

时间:2017-01-24 10:27:38

标签: wordpress .htaccess amazon-web-services https amazon-elb

我想在wordpress网站上强制使用https。该站点位于ec2实例上,并通过ELB指向,该转发端口http为80,https为443,分配给我的证书。

当我在https://mysite访问我的网站时,https网站正常运行。但我想将所有http重定向到https。我按照建议实现了HTTP:X-Forwarded-Proto,但网站没有转发。我错过了什么?!感谢

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule . https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

0 个答案:

没有答案