Reputation: 73
I have nginx 1.2.1. I want to rewrite:
http://mywebsite.com/[token].mp4
to http://mywebsite.com/get.php?token=[token]
Return error 404, my block:
location ~* \.(mp4)$ {
rewrite "^/([a-zA-Z0-9]{23})\$" /get.php?token=$1 break;
}
I tried this question but nothing, it returns error 404
Upvotes: 1
Views: 1579
Reputation: 1139
According to nginx.conf
you provided here, try below:
location ^~ /videos/ {
rewrite "^/videos/([a-zA-Z0-9]{23})\.mp4$" /get.php?token=$1 break;
}
This should match URL: example.com/videos/abc01234567890123456789.mp4
and redirect to example.com/get.php?token=abc01234567890123456789
DISCLAIMER: config not tested, may have some typos
Upvotes: 3
Reputation: 338
Perhaps try looking at the headers specifically content type like so:
https://unmitigatedrisk.com/?p=359
Upvotes: 0