2015-09-19 98 views
0

所有圖像都在上傳文件夾中。但它不在前端顯示。如果我直接打開鏈接,則說沒有找到該圖像的頁面。在wordpress站點上不顯示圖像

爲什麼這麼說?任何想法?

注意:沒有安裝新的插件。

.htaccess文件代碼:

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

# END WordPress 
# STRONG HTACCESS PROTECTION</code> 
<Files ~ "^.*\.([Hh][Tt][Aa])"> 
order allow,deny 
deny from all 
satisfy all 
</Files> 

# protect wp-config.php 
<files wp-config.php> 
Order deny,allow 
Deny from all 
</files> 

#disable hotlinking of images with forbidden or custom image option 
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^$ 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?wpbeginner.com [NC] 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/wpbeginner [NC] 
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L] 

# protect from sql injection 
Options +FollowSymLinks 
RewriteEngine On 
#RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] 
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] 
#RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) 
#RewriteRule ^(.*)$ index.php [F,L] 
+0

你最近從另一臺主機/環境/服務器移到您的網站? –

+0

沒有在它開始的同一位置 –

+0

..並且圖像從未顯示過?或突然消失? –

回答

0

- 這可能與的.htaccess位於的wp-content文件夾>確保它不會排除任何文件類型。

- 確保所有圖像chmod設置爲644;如果它們不是,您可以手動修復它們或使用ssh命令行自動恢復文件夾&的默認文件權限。

命令:

查找/路徑對網站文件夾型d -exec搭配chmod 755 {} +

查找/路徑對網站文件夾型的F -exec CHMOD 644 {} +

  • 如果沒有上述情況,我建議你從htaccess的刪除線的這一大塊:

#disable hotlinking of images with forbidden or custom image option 
 
RewriteEngine on 
 
RewriteCond %{HTTP_REFERER} !^$ 
 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?wpbeginner.com [NC] 
 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC] 
 
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?feeds2.feedburner.com/wpbeginner [NC] 
 
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

檢查其他.htaccess文件前的你的WordPress根路徑