403禁止:允许访问图像

发布于 2025-01-03 13:30:13 字数 518 浏览 0 评论 0原文

我目前正在 WordPress 中构建一个新版本的网站,并尝试正常添加一些图像以供 CSS 和 CSS 引用。 HTML。奇怪的是,它允许我添加几个图像,例如徽标等,但当我尝试添加更多图像时,它会给出下面的禁止消息。图像也没有出现,当我转到图像的路径时,会显示下面的禁止消息。

禁止

您无权访问 /v2/wp-content/themes/default/images/contact-yellow-icon.png 在此 服务器。此外,在执行此操作时遇到 404 Not Found 错误 尝试使用 ErrorDocument 来处理请求。

在我设置的其他几个 WP 网站中,我以前从未遇到过这个问题。可能是什么问题?

如果我输入另一个图像的路径,那么它工作正常(http://www.domain.com/v2/wp-content/themes/default/images/contact-innovation-logo.png)所以不知道为什么它不允许我访问其他图像!?

I'm currently building a new version of a site in Wordpress and trying to add a few images as normal to be referenced both by CSS & HTML. Weirdly it's allowed me to add several images like the logo etc yet when I try to add a few more images it's giving the forbidden message below. The image doesn't appear either and the forbidden message below shows when I goto the path of the image.

Forbidden

You don't have permission to access
/v2/wp-content/themes/default/images/contact-yellow-icon.png on this
server. Additionally, a 404 Not Found error was encountered while
trying to use an ErrorDocument to handle the request.

I've never had this problem before out of the several other WP sites I've setup. What could be the problem?

If I put in the path to another image then it works fine (http://www.domain.com/v2/wp-content/themes/default/images/contact-innovation-logo.png) so don't know why it won't allow me to access the other images!?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

谈场末日恋爱 2025-01-10 13:30:13

您应该检查 /v2/wp-content/themes/default/images/contact-yellow-icon.png 的文件权限,

我认为它们应该是 644,以便所有人都可以读取该文件

,或者您可以检查 /v2/wp 的文件权限-content/themes/default/images/contact-innovation-logo.png

您可以使用 ftp 管理器或使用

由 Eric Leroy 更新的 shell ** 更改权限
如果文件权限 644 不起作用,请更改为 755,这就是我用来解决问题的方法。如果您不熟悉如何在基于 *inx 的系统和 Mac 系统上执行此操作,请执行以下操作:
打开终端并导航到图像的父文件夹。
输入 sudo chmod -R 775 (然后在 775 之后输入图像文件夹的名称)
它会询问您的密码,然后您的图像将在您的网站上运行。

you should check file permissions for /v2/wp-content/themes/default/images/contact-yellow-icon.png

i think they should be 644 so that all can read that file

or you can check file permissions of /v2/wp-content/themes/default/images/contact-innovation-logo.png

you can change permissions with ftp manager or with shell

** updated by Eric Leroy
if file permissions 644 does not work, change to 755 that is what I used to fix the issue. If you are not familiar on how to do this on *inx based, and mac systems, here is how:
Open terminal and navigate to the parent folder of the images.
type sudo chmod -R 775 (then type the name of your images folder after 775 )
it will ask you for your password, then your images will work on your website.

不再让梦枯萎 2025-01-10 13:30:13

这也可能是由于使用热链接保护造成的。因此,如果使用热链接保护,请确保将您网站的 URL 添加到白名单中。另请记住,www.yourdomain.com 和 yourdomain.com 被视为两个不同的 URL。

This can also be caused by using hotlinking protection. So if hotlinking protection is used, make sure that the URL for your website is added to the white list. Also keep in mind that www.yourdomain.com and yourdomain.com are considered two different URLs.

初见 2025-01-10 13:30:13

对于原始用户来说,问题可能已经解决,但我发现更改权限或禁用热链接(已禁用)对我来说没有任何作用。

对我来说,不起作用的文件是主题 CSS 和 JavaScript 目录中的 php 文件。

我发现对我来说问题是 WordPress 创建的一个 .htaccess 文件,用于锁定以防止恶意代码注入。添加规则以允许这些文件允许它们工作。

The question may have been solved for the original user, but I found no amount changing permissions or disabling hotlinking (was already disabled) was working for me.

For me the files not working were php files in the themes CSS and JavaScript directories.

I found that for me the problem was a .htaccess file that WordPress created for a LOCKDOWN to prevent malicious code injections. Adding rules to allow these files allowed them to work.

与他有关 2025-01-10 13:30:13

尽管这是一个老问题,但我想为可能遇到同样问题的任何人添加此内容。

如果您使用的是 cloudflare,他们的刮盾也具有热链接保护 - 这就是我的问题的根源。

Although this is an old issue, I would like to add this for anyone who might visiting with the same problem.

If you're using cloudflare, their scrape shield also has hotlink protection - this was where my problem originated.

别闹i 2025-01-10 13:30:13

使用这个

sudo chmod -R a+rw /var

然后

<img src="../img/y.png">

Use this

sudo chmod -R a+rw /var

and then

<img src="../img/y.png">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文