2016-12-14 68 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