301 将 .mp4 文件重定向到链接 [英] 301 Redirect .mp4 file to a link

查看:41
本文介绍了301 将 .mp4 文件重定向到链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视频文件的链接 (example.com/abc.mp4),单击该链接后,我想重定向到另一个链接.我们不想更改页面上的链接,因为此链接已给出,因此如果可能,重定向它会更有意义.

I have a link to a video file (example.com/abc.mp4), which, when clicked, I would like to redirect to another link. We don't want to change the link on the page since this link was given out, so it would make more sense to redirect it, if possible.

我认为应该有一种方法可以通过 .htaccess 和 RegEx 来做到这一点,但一直没有找到解决方案的运气,或者谈论这样的事情.

I would think there should be a way to do this via .htaccess and RegEx, but have not been able to have any luck finding a solution, or talk about something like this.

有人有什么想法吗?

推荐答案

有两种可能:要么你做错了重定向规则,要么你的 Apache 忽略了 .htaccess 指令.¿你知道另一个重写规则是否有效吗?¿ 你能检查一下你的虚拟主机是否配置了 AllowOverride All 吗?

There are two chances: either you're doing the redirection rule wrong, or your Apache is ignoring the .htaccess directives. ¿Do you know if another rewrite rules are working? ¿Can you check if your vhost if configured with AllowOverride All?

此外,您可以尝试以下规则来重定向不存在的文件.只是为了确定:

Additionally, you could try the following rule to redirect a file which doesn't exist. Just to be sure:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^xyz\.mp4 http://www.newsite.com/newfile.mp4 [r=301,L]
</IfModule>   

这篇关于301 将 .mp4 文件重定向到链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆