2013-07-03 58 views
1
RewriteRule ^playlist/(.+)\.txt$ video.php?action=playlist&file=$1 [L] 
RewriteRule ^([a-z0-9]{32})/([a-zA-Z0-9/\+=]+)/([0-9]{1})\.(flv|mp4)$ video.php?url=$2&base64=1&action=play&sec_hash=$1&quality=$3 [L] 
RewriteRule ^([a-zA-Z0-9/\+=]+)/([0-9]{1})\.(flv|mp4)$ video.php?url=$1&base64=1&action=play&quality=$2 [L] 
RewriteRule ^download/([a-z0-9]{32})/([a-zA-Z0-9/\+=]+)\.(flv|mp4)$ video.php?url=$2&base64=1&action=download&sec_hash=$1 [L] 
RewriteRule ^download/([a-zA-Z0-9/\+=]+)\.(flv|mp4)$ video.php?url=$1&base64=1&action=download [L] 

我試試這個鱈魚,但不工作轉換apache的htaccess的nginx的RewriteEngine敘述

nginx的配置

location /playlist { rewrite ^/playlist/(.+)\.txt$ /video.php?action=playlist&file=$1 break; } 
location/{ rewrite "^/([a-z0-9]{32})/([a-zA-Z0-9/\+=]+)/([0-9]{1})\.(flv|mp4)$" /video.php?url=$2&base64=1&action=play&sec_hash=$1&quality=$3 break; } 
location/{ rewrite "^/([a-zA-Z0-9/\+=]+)/([0-9]{1})\.(flv|mp4)$" /video.php?url=$1&base64=1&action=play&quality=$2 break; } 
location/{ rewrite "^/download/([a-z0-9]{32})/([a-zA-Z0-9/\+=]+)\.(flv|mp4)$" /video.php?url=$2&base64=1&action=download&sec_hash=$1 break; } 
location /download { rewrite ^/download/([a-zA-Z0-9/\+=]+)\.(flv|mp4)$ /video.php?url=$1&base64=1&action=download break; } 
location/{ rewrite ^/([a-zA-Z0-9/\+=]+)\.jpg$ /video.php?url=$1&base64=1&action=thumb break; } 
+0

親愛的,告訴我們的代碼,你」我已經測試過了。 – jmingov

回答

0

試試這個:

location/{ 
    rewrite ^/playlist/(.+)\.txt$ /video.php?action=playlist&file=$1 last; 
    rewrite ^/([a-z0-9]{32})/([a-zA-Z0-9/\+=]+)/([0-9]{1})\.(flv|mp4)$ /video.php?url=$2&base64=1&action=play&sec_hash=$1&quality=$3 last; 
    rewrite ^/([a-zA-Z0-9/\+=]+)/([0-9]{1})\.(flv|mp4)$" /video.php?url=$1&base64=1&action=play&quality=$2 last; 
    rewrite ^/download/([a-z0-9]{32})/([a-zA-Z0-9/\+=]+)\.(flv|mp4)$ /video.php?url=$2&base64=1&action=download&sec_hash=$1 last; 
    rewrite ^/download/([a-zA-Z0-9/\+=]+)\.(flv|mp4)$ /video.php?url=$1&base64=1&action=download last; 
    rewrite ^/([a-zA-Z0-9/\+=]+)\.jpg$ /video.php?url=$1&base64=1&action=thumb last; 
} 
相關問題