I'm looking for a way to hide mp3 links form the source code in a post using the PHP method.
I've looked at several older methods that either crash my site or don't work at all.
https://mlitzinger.com/blog/obfuscating-file-paths-html-audio/
<audio src="/mp3.php?file_id=0"></audio>
<?php
if (strstr($_SERVER['HTTP_REFERER'], 'mattlitzingermusic.com/music') !== false) {
$track_id = $_GET['file_id'];
$tracks = array(
'/audio/file_0.mp3',
'/audio/file_1.mp3',
'/audio/file_2.mp3',
'/audio/file_3.mp3'
);
header('Location: ' . $tracks[$track_id]);
} else {
header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden', true, 403);
echo '<h1>Forbidden</h1><p>You don\'t have permission to access this
file. </p><hr>';
}
I'm wanting this to hide the mp3 URLs when you view the source code in a post to make it more difficult for novices to download.