2017-04-03 53 views
0

我想要將幾個.htaccess規則轉換爲NGINX,但是它不會很好。我必須在這裏爬行,並尋求幫助:(〜Paypal啤酒給任何解決它的人。將一些規則從.htacess轉換爲NGINX

我已經嘗試了一些在線轉換器,但代碼看起來很亂,我不太明白它在做什麼。規則我想已經轉換:。

# Rewrite any calls to html|json|xml|atom|rss 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule (.+)\.(html|json|xml|atom|rss)$ $1/ [L] 

# Rewrite any calls to /render to the image resizer 
RewriteCond %{REQUEST_URI} render/ 
RewriteRule ^render/. app/parsers/slir/ [L] 

# Rewrite routes to application index.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)/$ index.php?/$1/ [L,QSA] 

感謝所有幫助

回答

0

我相信這是分類裏面一個NGINX server {}塊,我包括以下內容:

location/{ 
    if (!-e $request_filename){ 

    # Rewrite any calls to html|json|xml|atom|rss if a folder matching * exists 
    rewrite (.+)\.(html|json|xml|atom|rss)$ $1/ last; 

    # Rewrite any calls to /render to the X3 image resizer 
    rewrite ^/render/. /app/parsers/slir/ last; 

    # Rewrite routes to X3 application index.php if they are non-existent files/dirs 
    rewrite ^(.*)$ /index.php?$1 last; 
    } 
} 

https://gist.github.com/mjau-mjau/6dc1948284c90d167f51f1e566a8457b