2016-10-22 207 views
0

我最近從一個Apache移動到一個Nginx網絡服務器,但是由於重寫規則不正確,腳本似乎有問題。htaccess到nginx重寫規則

我試過winginx.com,一個網站,從htaccess的提供轉換但是nginx的它並沒有真正似乎工作

的重寫如下:

RewriteRule ^people/([0-9]+)$ people.php?p=$1 [NC,L] 
RewriteRule ^user/([0-9]+)$ profile.php?id=$1 [NC,L] 
RewriteRule ^user/([0-9]+)/photo_upload$ profile.php?id=$1&photo_upload=true [NC,L] 
RewriteRule ^index.php?login/?$ index.php?login [NC,L] 
RewriteRule ^visitors/?$ visitors.php [NC,L] 

一些專家的幫助會不勝感激,謝謝

回答

0

這些重寫應該工作:

rewrite ^people/([0-9]+)$ /people.php?p=$1 last 
rewrite ^user/([0-9]+)$ /profile.php?id=$1 last 
rewrite ^user/([0-9]+)/photo_upload$ /profile.php?id=$1&photo_upload=true last 
rewrite ^index.php\?login/?$ /index.php?login last 
rewrite ^visitors/?$ /visitors.php last 

將它們添加到您的主要位置或所有位置塊中。