屏蔽所有传出链接
我有一个软件下载网站,所有软件都托管在 Amazon S3 上。我的网站使用 WordPress,我不希望访问者知道我在 Amazon S3 上托管所有软件。我想将所有 Amazon S3 URI 重写为我的网站 url,每当访问者单击这些 URI 时,他们应该被重定向到 Amazon S3...
我尝试使用 Pretty Links Lite 插件来隐藏 Amazon S3 链接,但该插件速度非常慢并且缺乏支持。
有人对如何实现这一目标有一些建议或更好的建议吗?
I have a software download site where all the software is hosted on Amazon S3. I am using WordPress for my site and I don't want my visitors to know that I am hosting all of the software on Amazon S3. I want to rewrite all Amazon S3 URIs to my site url and whenever visitors click those URIs they should be redirected to Amazon S3...
I tried the Pretty Links Lite plugin to hide the Amazon S3 links, but that plugin is extremely slow and lacks support.
Does anyone have some advice or a better recommendation of how to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除非您想通过服务器流式传输下载内容(这会破坏在 Amazon S3 上托管的意义),否则您将无法掩盖下载内容位于 Amazon S3 上的事实。
Unless you want to stream your downloads via your server (which would ruin the point of hosting on Amazon S3), you won't be able to mask the fact your downloads are on Amazon S3.
加入游戏有点晚了,但我在 Pretty Links Lite 中遇到了同样的问题。添加的漂亮链接越多,即使使用积极的缓存,网站的速度也会越慢。
我的解决方案是创建一个名为
redirect
的自定义帖子类型并使用一些自定义字段(尽管我使用高级自定义字段插件以获得更优雅的后端体验)。然后只需添加一个与template_redirect
挂钩的快速函数来检查您的帖子类型。唯一的缺点是您需要为 CPT 分配一个 slug,但您可以在注册函数中轻松自定义它。
这是我的代码:
正如我所说,您可以使用自定义字段或 ACF 插件来设置一些元框 - 1 个用于公共链接,另一个用于真正的目的地。我假设您使用普通自定义字段。然后将其插入到您的
functions.php
或主题函数文件中:Joining the game a little late but I ran into the same issue with Pretty Links Lite. The more Pretty Links you add the more it slows down your site, even with aggressive caching.
My solution was to make a custom post type called
redirect
and use some custom fields (though I use the Advanced Custom Fields plugin for a more elegant backend experience). Then simply add a quick function that hooks intotemplate_redirect
that checks for your post type.The only drawback is that you need to assign a slug to your CPT, but you can easily customize that in the register function.
Here is my code:
As I said, you can use custom fields or the ACF plugin to setup a few metaboxes–1 for the public link and the other for the true destination. I'll assume you use vanilla custom fields. Then plug this into your
functions.php
or theme functions file: