I wanna to create a .htaccess file to be executed when an especial address is requested.
for example when this address is requested: http://my-website.ir/download/folder2/video22.mp4
I want to change this address to http://my-website.ir/check-dl.php?folder_name=folder2&file_name=video22.mp4
but I don't want user or his Internet Download Manager to understand this address change.
Asked
Active
Viewed 244 times
0

Mahdi98
- 135
- 1
- 2
- 8
-
may be this link can be helpful https://stackoverflow.com/questions/33187793/force-file-to-download-with-htaccess – Pravin Prajapati Jan 12 '18 at 06:47
-
or you can add this code in your .htaccess `AddType application/octet-stream .csv AddType application/octet-stream .xls AddType application/octet-stream .doc AddType application/octet-stream .avi AddType application/octet-stream .mpg AddType application/octet-stream .mov AddType application/octet-stream .pdf` – Pravin Prajapati Jan 12 '18 at 06:48
1 Answers
0
Try this by adding the below code in your .htaccess
Options +FollowSymlinks RewriteEngine on RewriteRule ^download/([^/]+)/([^/]+).mp4 /check-dl.php?folder_name=$1&file_name=$2.mp4 [NC]

esparklight
- 19
- 3
-
Can you change your coed? I want folder2 and video22.mp4 be as parameters means if user entered another folder name and another file name theme folder_name and file_name variables should be changed according to the requested address.thank! – Mahdi98 Jan 12 '18 at 12:00
-
Please try this "RewriteRule ^download/([^/]+)/([^/]+).mp4 /check-dl.php?folder_name=$1&file_name=$2.mp4 [NC]" – esparklight Jan 12 '18 at 12:15