Ar Megatox
Ar Megatox

Reputation: 57

htaccess 404 error redirect to video

i have some videos (.m3u8) in a directory
users play them in web or phone players (android,ios,jw web player,web flowplayer-html5)

so sometimes they play files that dont exist example 123.m3u8 234.m3u8 ... so is there a way to make a default video so if anyone is playing a file that dont exist then to play default.m3u8

i tryed

 ErrorDocument 404 http://example.com/default.m3u8

but when i test on web players it doesnt work (u can test here http://demo.jwplayer.com/stream-tester/ )

so maybe because it redirect the url from xxxx.m3u8 to default.m3u8 so is there a way to fix this or maybe a think a way that will play default.m3u8 but url will be xxxx.m3u8

Upvotes: 0

Views: 137

Answers (2)

Amit Verma
Amit Verma

Reputation: 41219

You can use an absolute path instead of the full url :

ErrorDocument 404 /default.m3u8

This will not redirect the non-existent request but internally rewrite it to /default.m3u8 .

Upvotes: 1

Rinat
Rinat

Reputation: 429

Hello code below should help

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule \.m3u8 /path/to/default.m3u8 [NC,L]

Upvotes: 0

Related Questions