开发者

How do I redirect a not found FLV file to a 404 FLV file, using .htaccess?

开发者 https://www.devze.com 2023-01-03 06:46 出处:网络
Using .htaccess, how do I permanently redirect all not found *.flv files in one directory to a 404.flv f开发者_JAVA百科ile in the same directory. For example:

Using .htaccess, how do I permanently redirect all not found *.flv files in one directory to a 404.flv f开发者_JAVA百科ile in the same directory. For example:

If this file is not found: example.com/flv/*.flv

Use this file: example.com/flv/404.flv

Here's what I have so far (I'm very bad):

RewriteCond /flv/(.*).flv !-f
RewriteRule ^ /flv/404.flv [L,R=301]

Thanks


You need two separate conditions. And you want to return a 404 response.

RewriteCond %{REQUEST_URI} ^/flv/.*\.flv$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* %{DOCUMENT_ROOT}/flv/404.flv [L,R=404]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号