RewriteEngine On
RewriteBase /

# For movies
RewriteCond %{REQUEST_URI} ^(.*/)(movie/.*) 
RewriteRule ^movie/.*/([0-9]+)\.[a-z0-9]+$ %1play.php?movieId=$1 [R=302,L]

# For series
RewriteCond %{REQUEST_URI} ^(.*/)(series/.*)
RewriteRule ^series/.*/([0-9]+)\.(.+)$ %1play.php?type=series&movieId=$1&data=$2 [R=302,L]

# For live
RewriteCond %{REQUEST_URI} ^(.*/)(live/.*)
RewriteRule ^live/.*/([0-9]+)\.[a-z0-9]+$ %1live_play.php?streamId=$1 [R=302,L]

# For Live M3U8 Playlist
RewriteCond %{REQUEST_URI} ^(.*/)(tv\.m3u8)
RewriteRule ^tv\.m3u8$ %1player_api.php?action=get_live_streams&type=m3u8 [R=302,L]

# For Movies M3U8 Playlist
RewriteCond %{REQUEST_URI} ^(.*/)(movies\.m3u8)
RewriteRule ^movies\.m3u8$ playlist.m3u8 [R=302,L]