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]
精彩评论