簡體   English   中英

htaccess到nginx重寫規則

[英]htaccess to nginx rewrite rules

我最近從Apache移到了Nginx Web服務器,但是由於重寫規則無法正常工作,腳本似乎出現了問題。

我嘗試過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]

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

這些重寫應該起作用:

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM