My problem is to redirect from subdirectory link to one file. my current url
www.sample.com/stream/34/video.m3u8
www.sample.com/stream/35/video.m3u8
hope
www.sample.com/stream.php?param1=35¶m2=video.m3u8
or
www.sample.com/stream/index.php?param1=35¶m2=video.m3u8
Please save my life
CodePudding user response:
You can do something like the following using mod_rewrite in the root .htaccess
file in order to rewrite the request to /stream.php?param1=<id>¶m2=<file>
:
Options -MultiViews
RewriteEngine On
RewriteRule ^stream/(\d )/([\w-] \.\w{2,4})$ stream.php?param1=$1¶m2=$2 [L]
This assumes that the <id>
(2nd path segment) is entirely numeric and the 3rd path segment consists of <filename>.<ext>
. You should restrict this to m3u8
if that is all you are expecting.