需要幫助將.htaccess重寫規則轉換爲nginx配置。規則來自metro縮小網址縮寫腳本。.htaccess重寫爲nginx配置
RewriteEngine On
#RewriteBase/
RewriteRule ^developer.html$ developer.php [QSA,L]
RewriteRule ^multishrink.html$ multishrink.php [QSA,L]
RewriteRule ^stats.html$ public-stats.php [QSA,L]
RewriteRule ^feed.rss feed.php [QSA,L]
RewriteRule ^([^/]+)\.qrcode$ qrcode.php?id=$1 [QSA,L]
RewriteRule ^api.php$ API/simple.php [QSA,L]
RewriteRule ^API/write/(get|post)$ API/write.php?method=$1 [QSA,L]
RewriteRule ^API/read/(get|post)$ API/read.php?method=$1 [QSA,L]
RewriteRule ^([^/]+)/stats$ stats.php?id=$1 [QSA,L]
RewriteRule ^([^/]+)/unlock$ unlock.php?id=$1 [QSA,L]
# If path is not a directory or file then apply RewriteRule
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9a-zA-Z-]{1,60})$ go.php?id=$1 [QSA,L]
感謝回覆,但我得到了兩個錯誤1)無效參數「= 404」2)在「設置」指令 – user1624300
另一個錯誤[emerg] pcre_compile()失敗失蹤)中的參數無效「^([0-9a-zA- Z-]「 – user1624300
pcre_compile是因爲正則表達式涉及的大括號也用於劃分塊,所以正則表達式必須被引用。在我的回答 – cobaco