2010-11-17 15 views
3

你好,即時嘗試設置韭菜在nginx,有人可以幫我轉換它的htaccess嗎?韭菜在nginx上,htaccess

Options +FollowSymLinks 
IndexIgnore */* 
DirectoryIndex index.php 

<IfModule mod_rewrite.c> 
    RewriteEngine on 

    # if a directory or a file exists, use it directly 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 

    # otherwise forward it to index.php 
    RewriteRule . index.php?__chive_rewrite_on=1&%{QUERY_STRING} 
    RewriteRule ^$ index.php?__chive_rewrite_on=1&%{QUERY_STRING} 
</IfModule> 

回答

6

如果你在一個子目錄 「韭菜」 安裝韭黃做到以下幾點:

location /chive/ { 
     try_files $uri chive/$uri/ /chive/index.php?q=$uri&$args; 
} 

沒有子目錄:

location/{ 
# ... existing options ... check twice! 
     try_files $uri $uri/ /index.php?q=$uri&$args; 
} 

代替的$ args你可以用$ QUERY_STRING,根據http://wiki.nginx.org/HttpCoreModule(它寫道:「與$ args相同,只是該變量是隻讀的。」)

+0

非常感謝,它解決了這個問題。 – flegmatyk 2012-03-28 20:29:58