301 Redirect .mp4 file to a link

戏子无情 提交于 2021-02-11 17:25:38

问题


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.

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.

Does anyone have any ideas?


回答1:


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>   


来源:https://stackoverflow.com/questions/24124416/301-redirect-mp4-file-to-a-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!