2017-08-10 153 views
1

我的非商業網站danijelaenjoriskoken.nl有一個奇怪的問題。WordPress在所有瀏覽器中都不顯示圖片

在許多系統上,它能完美顯示所有圖像。

但是,幾個系統(約25%的已知系統)不顯示圖像,只有一個空白的矩形,中間有一個小圖像圖標。但是,如果右鍵單擊此矩形並選擇「查看圖像」,則會顯示正確的圖像。回到原始頁面,圖像突然出現。在刷新頁面之前,這會再次導致圖像消失。

我想不通的瀏覽器顯示或不顯示圖像之間的差異:,我的Mac上的書,在我的Windows筆記本電腦和臺式機(IE

  1. 我可以看到我的Android手機上的圖像, Edge,Safari和Chrome)
  2. 我無法在Android平板電腦上看到自己的圖像。沒有看到圖像的朋友正在使用iPhone 5和6,mac書,Windows桌面。

它不可能是一個簡單的權利問題,因爲它可能在每個系統上查看圖像,儘管您必須首先直接查看圖像。

查看之後,它可以顯示在頁面中......直到您重新加載,就像它是由於它在頁面中顯示的一些緩存一樣。但這意味着WordPress總是知道圖像的正確位置。

我用Google搜索,並在這個網站,但我只找到完全缺失的圖像,由於不正確的權利,不正確的編碼,不正確的媒體庫等問題

更新1 這個問題似乎是由於在網址中有www(見評論)。

我確實安裝了WP安全模塊,它有一個複製保護選項,但沒有被選中。

我檢查了.htaccess,但我自己弄不明白。這是內容:

 

    # BEGIN All In One WP Security 
    #AIOWPS_BASIC_HTACCESS_RULES_START 
    
    
    Require all denied 
    
    
    Order deny,allow 
    Deny from all 
    
    
    ServerSignature Off 
    LimitRequestBody 10240000 
    
    
    Require all denied 
    
    
    Order deny,allow 
    Deny from all 
    
    
    #AIOWPS_BASIC_HTACCESS_RULES_END 
    #AIOWPS_PINGBACK_HTACCESS_RULES_START 
    
    
    Require all denied 
    
    
    Order deny,allow 
    Deny from all 
    
    
    #AIOWPS_PINGBACK_HTACCESS_RULES_END 
    #AIOWPS_DEBUG_LOG_BLOCK_HTACCESS_RULES_START 
    
    
    Require all denied 
    
    
    Order deny,allow 
    Deny from all 
    
    
    #AIOWPS_DEBUG_LOG_BLOCK_HTACCESS_RULES_END 
    #AIOWPS_DISABLE_INDEX_VIEWS_START 
    Options -Indexes 
    #AIOWPS_DISABLE_INDEX_VIEWS_END 
    #AIOWPS_DISABLE_TRACE_TRACK_START 
    
    RewriteEngine On 
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) 
    RewriteRule .* - [F] 
    
    #AIOWPS_DISABLE_TRACE_TRACK_END 
    #AIOWPS_FORBID_PROXY_COMMENTS_START 
    
    RewriteEngine On 
    RewriteCond %{REQUEST_METHOD} ^POST 
    RewriteCond %{HTTP:VIA} !^$ [OR] 
    RewriteCond %{HTTP:FORWARDED} !^$ [OR] 
    RewriteCond %{HTTP:USERAGENT_VIA} !^$ [OR] 
    RewriteCond %{HTTP:X_FORWARDED_FOR} !^$ [OR] 
    RewriteCond %{HTTP:X_FORWARDED_HOST} !^$ [OR] 
    RewriteCond %{HTTP:PROXY_CONNECTION} !^$ [OR] 
    RewriteCond %{HTTP:XPROXY_CONNECTION} !^$ [OR] 
    RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR] 
    RewriteCond %{HTTP:HTTP_CLIENT_IP} !^$ 
    RewriteRule wp-comments-post\.php - [F] 
    
    #AIOWPS_FORBID_PROXY_COMMENTS_END 
    #AIOWPS_DENY_BAD_QUERY_STRINGS_START 
    
    RewriteEngine On 
    RewriteCond %{QUERY_STRING} ftp:  [NC,OR] 
    RewriteCond %{QUERY_STRING} http: [NC,OR] 
    RewriteCond %{QUERY_STRING} https: [NC,OR] 
    RewriteCond %{QUERY_STRING} mosConfig [NC,OR] 
    RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR] 
    RewriteCond %{QUERY_STRING} (\;|'|\"|%22).*(request|insert|union|declare|drop) [NC] 
    RewriteRule ^(.*)$ - [F,L] 
    
    #AIOWPS_DENY_BAD_QUERY_STRINGS_END 
    #AIOWPS_SIX_G_BLACKLIST_START 
    # 6G FIREWALL/BLACKLIST 
    # @ https://perishablepress.com/6g/ 

    # 6G:[QUERY STRINGS] 
    
    RewriteEngine On 
    RewriteCond %{QUERY_STRING} (eval\() [NC,OR] 
    RewriteCond %{QUERY_STRING} (127\.0\.0\.1) [NC,OR] 
    RewriteCond %{QUERY_STRING} ([a-z0-9]{2000,}) [NC,OR] 
    RewriteCond %{QUERY_STRING} (javascript:)(.*)(;) [NC,OR] 
    RewriteCond %{QUERY_STRING} (base64_encode)(.*)(\() [NC,OR] 
    RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC,OR] 
    RewriteCond %{QUERY_STRING} (|%3) [NC,OR] 
    RewriteCond %{QUERY_STRING} (\|\.\.\.|\.\./|~|`||\|) [NC,OR] 
    RewriteCond %{QUERY_STRING} (boot\.ini|etc/passwd|self/environ) [NC,OR] 
    RewriteCond %{QUERY_STRING} (thumbs?(_editor|open)?|tim(thumb)?)\.php [NC,OR] 
    RewriteCond %{QUERY_STRING} ('|\")(.*)(drop|insert|md5|select|union) [NC] 
    RewriteRule .* - [F] 
    

    # 6G:[REQUEST METHOD] 
    
    RewriteCond %{REQUEST_METHOD} ^(connect|debug|move|put|trace|track) [NC] 
    RewriteRule .* - [F] 
    

    # 6G:[REFERRERS] 
    
    RewriteCond %{HTTP_REFERER} ([a-z0-9]{2000,}) [NC,OR] 
    RewriteCond %{HTTP_REFERER} (semalt.com|todaperfeita) [NC] 
    RewriteRule .* - [F] 
    

    # 6G:[REQUEST STRINGS] 
    
    RedirectMatch 403 (?i)([a-z0-9]{2000,}) 
    RedirectMatch 403 (?i)(https?|ftp|php):/ 
    RedirectMatch 403 (?i)(base64_encode)(.*)(\() 
    RedirectMatch 403 (?i)(=\'|=\%27|/\'/?)\. 
    RedirectMatch 403 (?i)/(\$(\&)?|\*|\"|\.|,|&|&?)/?$ 
    RedirectMatch 403 (?i)(\{0\}|\(/\(|\.\.\.|\+\+\+|\\"\\") 
    RedirectMatch 403 (?i)(~|`||:|;|,|%|\|\s|\{|\}|\[|\]|\|) 
    RedirectMatch 403 (?i)/(=|\$&|_mm|cgi-|etc/passwd|muieblack) 
    RedirectMatch 403 (?i)(&pws=0|_vti_|\(null\)|\{\$itemURL\}|echo(.*)kae|etc/passwd|eval\(|self/environ) 
    RedirectMatch 403 (?i)\.(aspx?|bash|bak?|cfg|cgi|dll|exe|git|hg|ini|jsp|log|mdb|out|sql|svn|swp|tar|rar|rdf)$ 
    RedirectMatch 403 (?i)/(^$|(wp-)?config|mobiquo|phpinfo|shell|sqlpatch|thumb|thumb_editor|thumbopen|timthumb|webshell)\.php 
    

    # 6G:[USER AGENTS] 
    
    SetEnvIfNoCase User-Agent ([a-z0-9]{2000,}) bad_bot 
    SetEnvIfNoCase User-Agent (archive.org|binlar|casper|checkpriv|choppy|clshttp|cmsworld|diavol|dotbot|extract|feedfinder|flicky|g00g1e|harvest|heritrix|httrack|kmccrew|loader|miner|nikto|nutch|planetwork|postrank|purebot|pycurl|python|seekerspider|siclab|skygrid|sqlmap|sucker|turnit|vikspider|winhttp|xxxyy|youda|zmeu|zune) bad_bot 

    # Apache 
    Order Allow,Deny 
    Allow from all 
    Deny from env=bad_bot 
    

    # Apache >= 2.3 
    
    
    Require all Granted 
    Require not env bad_bot 
    
    
    
    #AIOWPS_SIX_G_BLACKLIST_END 
    #AIOWPS_BLOCK_SPAMBOTS_START 
    
    RewriteEngine On 
    RewriteCond %{REQUEST_METHOD} POST 
    RewriteCond %{REQUEST_URI} ^(.*)?wp-comments-post\.php(.*)$ 
    RewriteCond %{HTTP_REFERER} !^http(s)?://danijelaenjoriskoken\.nl [NC,OR] 
    RewriteCond %{HTTP_USER_AGENT} ^$ 
    RewriteRule .* http://127.0.0.1 [L] 
    
    #AIOWPS_BLOCK_SPAMBOTS_END 
    #AIOWPS_PREVENT_IMAGE_HOTLINKS_START 
    
    RewriteEngine On 
    RewriteCond %{HTTP_REFERER} !^$ 
    RewriteCond %{REQUEST_FILENAME} -f 
    RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g?|png)$ [NC] 
    RewriteCond %{HTTP_REFERER} !^http(s)?://danijelaenjoriskoken\.nl [NC] 
    RewriteRule \.(gif|jpe?g?|png)$ - [F,NC,L] 
    
    #AIOWPS_PREVENT_IMAGE_HOTLINKS_END 
    # END All In One WP Security 

    # BEGIN WordPress 
    
    RewriteEngine On 
    RewriteBase/
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.php [L] 
    

    # END WordPress 

+0

任何代碼或鏈接到網站可能會有所幫助 –

+0

[http://www.danijelaenjoriskoken.nl](http:// www。danijelaenjoriskoken.nl) –

回答

2

從您的網站的圖像不顯示在我的機器上(Windows 10)。檢查員正顯示出以下錯誤的圖片:

無法加載資源:服務器與403 (禁止)

狀態這聽起來好像是一個權限的問題作出迴應。檢查這些圖像的文件權限。他們應該是644。

更新:

現在我發現,如果我去使用WWW網站,圖像不工作: http://www.danijelaenjoriskoken.nl/

但是,如果我去的網站加www中,影像工作:

http://danijelaenjoriskoken.nl/

所以我想,無論是.htaccess文件,某些插件或服務器啓用了「防止盜鏈」功能,這就是問題的原因。

更新2:

也注意到,當我加載使用http://danijelaenjoriskoken.nl/的siter和圖像顯示,如果我那麼它再次使用WWW加載,圖像只是工作和問題消失。

+0

感謝您的快速回復。我檢查了Filezilla中的所有文件。每個圖像都有-rw-rw-rw-rights(這是666,我假設?)這可能是問題嗎?但是我在所有瀏覽器中都能看到圖像,而且我也有Windows 10. –

+0

另一種可能性是.htaccess文件中的問題,可能是由於您正在使用一些安全性插件? – user8230352

+0

我可以使用Chrome,Firefox和Edge在Windows 10機器上看到圖像。這不能成爲文件許可問題,因爲它應該普遍失敗。 – user8262086

1

我不明白'www'來自哪裏,我認爲這應該首先被理解。但是,作爲最後度假您可以添加

RewriteCond %{HTTP_HOST} www\.danijelaenjoriskoken\.nl [NC] 
RewriteRule ^/(.*)   http://danijelaenjoriskoken.nl/$1 [L,R] 

此答案屬於user8230352誰發現了這個問題的關鍵特徵這應該重寫www.danijelaenjoriskoken.nl到danijelaenjoriskoken.nl

信用。我試圖添加這個作爲評論,但它不會正確格式。

1

User8230352在特徵(www與非www)中是正確的。

User8262086在重寫規則中幾乎是正確的。

重寫規則必須是:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^www\.danijelaenjoriskoken\.nl [NC] 
RewriteRule ^(.*)$ http://danijelaenjoriskoken.nl/$1 [L,R=301] 

隨着該文件的頂部這些規則,該網站顯示正確的,由於剝離網址。

這解決了症狀。

但是,由於給出的答案和靈感來自於給定的答案,我禁用了模塊WP All in One Security,以找出問題的根本原因。

禁用模塊後,一堆代碼已從.htaccess中消失。我也刪除了我自己的上面的重寫規則。現在,即使使用帶www前綴的網址,WordPress也顯示圖像。

因爲我希望有一些垃圾郵件保護,我再次激活模塊來測試哪個設置導致問題......仍然看... .htaccess保持光滑和乾淨,只是一些規則。

似乎某種程度上.htaccess是如此嚴重混亂,或與矛盾規則,該網站是無法coop與它。