Hide/Custom download path for files PHP using MySQL Database

In this video I have shown how you can have custom link for your download path in PHP. This example worked on xampp server and you should have MySQL installed on your server.

1.Project Structure.

The files are hosted inside files folder.

2. First create a table in database and save the file information with a fakeid, filename and path as shown below.

3. So in the index.php we have created download links for all the files with the fake id as the identifier for each file.

4. To mask the download.php page we have created a rewrite rule in htaccess file. The structure of htaccess file is shown below.

5. In the download.php page once the identifier is received when the user clicks to download the file, We call the mysql database connection and execute the select query to get the actual download path.Once the download path is received from the database, The webpage force to download the file from the path.

6. Project after running in local host server is shown below.