2014-05-13 332 views
0

有人可以幫我將這條規則轉換爲nginx嗎?我需要它來提供HTML爲XHTML SVG的面具在FireFox將apache htaccess重寫規則轉換爲nginx重寫規則

RewriteEngine on 
RewriteBase/
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml 
RewriteCond %{HTTP_ACCEPT} !application/xhtml\+xml\s*;\s*q=0 
RewriteCond %{REQUEST_URI} \.html$ 
RewriteCond %{THE_REQUEST} HTTP/1\.1 
RewriteRule .* - [T=application/xhtml+xml] 

回答

0

更復雜

set $var "q"; 
if ($http_accept ~ application/xhtml\+xml) { 
    set $var "q$var"; 
} 
if ($http_accept !~ 'application/xhtml\+xml\s*;\s*q=0') { 
    set $var "q$var"; 
} 
if ($uri ~ \.html$) { 
    set $var "q$var"; 
} 
if ($server_protocol = HTTP/1.1) { 
    set $var "q$var"; 
} 
if ($var = qqqqq) { 
    add_header 'Content-Type' 'application/xhtml+xml'; 
} 

沒有測試

+0

我將測試它讓你知道,THX – gidzior