rewrite - Nginx - Redirect url for certain file type -


i have nginx 1.2.1. want rewrite:

http://mywebsite.com/[token].mp4 http://mywebsite.com/get.php?token=[token]

return error 404, block:

location ~* \.(mp4)$ {     rewrite "^/([a-za-z0-9]{23})\$" /get.php?token=$1 break; } 

i tried this question nothing, returns error 404

according nginx.conf 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 , redirect example.com/get.php?token=abc01234567890123456789

disclaimer: config not tested, may have typos


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -