2016-12-14 52 views
0

我得到了WordPress站点混合内容的错误,之后我建立了从http自动重定向到HTTPS在Apache。混合内容的错误与Apache虚拟主机

Mixed Content: The page at 'https://example.example.com/' was loaded over HTTPS, but requested an insecure stylesheet http://example.example.com/wp-content/uploads/elementor/css/post-2612.css?ver=1481615259'. This request has been blocked; the content must be served over HTTPS

我想知道如果我的htaccess /虚拟主机或可能与该代码,CSS等问题..

我htaccess的代码如下所示:

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

My VirtualHost看起来像这样:

<VirtualHost *:80> 
    RewriteEngine On 
    RewriteCond %{HTTPS} off 
    RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] 
    ServerName example.example.com 
    ServerAdmin [email protected] 
    DocumentRoot /mnt/data/html1 
    ErrorLog /mnt/data/html1/example.example.com_error.log 
    CustomLog /mnt/data/html1/example.example.com_access_log combined env=!dontlog 
</VirtualHost> 

<VirtualHost _default_:443> 
    SSLEngine on 
    RewriteEngine On 
    RewriteCond %{HTTPS} on 
    SSLCertificateFile /etc/httpd/sites-available/crt.crt 
    SSLCertificateKeyFile /etc/httpd/sites-available/pem.pem 
    ServerName example.example.com 
    DocumentRoot /mnt/data/html1 
    ErrorLog /mnt/data/html1/example.example.com_error.log 
    CustomLog /mnt/data/html1/example.example.com_access_log combined env=!dontlog 
</VirtualHost> 

<Directory "/mnt/data/html1"> 
    AuthType Basic 
    AuthName "Restricted Content" 
    AuthUserFile /mnt/data/html1/.htpasswd 
    Require valid-user 
    Options Indexes FollowSymLinks 
    AllowOverride All 
    Order allow,deny 
    Allow from all 
</Directory> 

回答

1

追踪并解决所有问题混合内容问题可能令人讨厌。这里有一个从谷歌有条不紊地通过它的优秀指南。 https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content

个人我一直在使用cloudflare的DNS自动重写系统,这是完全的交钥匙和懒惰的一个很好的伎俩。

尽管chrome应该识别通过第三方加载的内容之间的区别(假设您有JS供应商lib从某处拉取资源,但我知道这有时会导致警告,请在浏览器中查看您的网络选项卡,出站链接被触发的问题。

+0

感谢,我将等待更多的答案,也许有什么毛病我重写配置。 – Berlin

+0

别人大概是看到htaccess的错误较好,但有你使用的理由<虚拟主机_default_:443>而不是<虚拟主机*:443>尽管混合内容错误,是你 – baku

+0

流量重定向正确到目前为止看起来混合内容errors'旁边'OK,你建议改变'<虚拟主机*:??443 > '? – Berlin