所有图片都在uploads文件夹中。但它没有显示在前端。如果我直接打开链接,则表示找不到该图像的页面。
为什么这样?有什么想法吗?
注意:没有安装新的插件。
.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)
- 这可能与位于wp-content文件夹中的.htaccess有关&gt;确保它不排除任何文件类型。
- 确保所有图像chmod都设置为644;如果不是,您可以手动修复它们,也可以使用ssh命令行自动恢复文件的默认文件权限。文件夹。
命令:
find / path-to-website-folder -type d -exec chmod 755 {} +
find / path-to-website-folder -type f -exec chmod 644 {} +
#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]
检查wordpress根路径前面的其他.htaccess文件