阻止从 Magento 中的媒体文件夹下载

发布于 2024-11-25 02:24:04 字数 259 浏览 0 评论 0原文

如果有人知道服务器上媒体文件的文件夹路径,是否有任何新方法可以阻止他们直接下载媒体文件? 我知道以前从来没有,但想知道在过去的几年里是否出现了任何新的东西?

或者也许我之前错过了一些东西,而这总是可能的?

我的 Magento 1.4.0.1 商店有大量图像,其中很多是我投入了大量工作的。我正在使用 Magento 水印系统,该系统工作正常,但如果您知道图像的直接文件系统路径,您将获得原始的无水印图像。

如果可以的话我想阻止它?

干杯!

Are there any new methods to prevent someone directly downloading a media file if they know the folder path to it on the server?
I know there never used to be, but wondered if anything new to this end had cropped up in the last couple of years?

Or maybe I missed something before and this was always possible??

My Magento 1.4.0.1 store has tons of images, a lot of which I have put a lot of woork into. I am using the Magento watermarking system, which works fine, but if you know the direct file system path to the image, you get served the original, non-watermarked image.

I'd like to stop that if possible?

Cheers!

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

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

发布评论

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

评论(2

江心雾 2024-12-02 02:24:04

解决方案是通过 .htaccess 拒绝访问这些文件夹。 PHP 留给我们的坏习惯之一是将所有内容都放在 Web 根目录中,正如您所说,这允许人们在网站本身的上下文之外访问单个文件。但是,您可以将一个名为 .htaccess 的文件放置在任何您喜欢的文件夹中以阻止该访问。文件的内容应如下所示:

Order deny,allow
Deny from all  

请注意,这仍将允许 PHP 访问文件以生成新的拇指,但将禁止所有浏览器访问这些文件。

希望有帮助!

谢谢,

The solution to this is to deny access to those folders via .htaccess. One of the bad habits that PHP leaves us with is putting everything inside of the web root, which as you say allows people to access individual files out of context of the website itself. However, you can place a file in any folder you like called .htaccess to block that access. The contents of the file should look something like this:

Order deny,allow
Deny from all  

Note that this will still allow PHP to access the files to generate new thumbs, but will disallow all browser access to the files.

Hope that helps!

Thanks,
Joe

后来的我们 2024-12-02 02:24:04

预先给图像加水印对您来说是一个可以接受的解决方案吗?您还将在此过程中节省一些周期。简单的Google 搜索就可以找到一些免费(如啤酒)水印工具的链接。不过,我还没有测试过其中任何一个。

Would watermarking your images beforehand be an acceptable solution for you? You'll also save some cycles in the process. A simple Google search turned up some links to free (as in beer) watermarking tools. I haven't tested any of those, though.

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