2013-12-21 41 views
3

阿帕奇重寫規則,我有一個非常簡單的重寫規則對Nginx的工作:用Perl反斜槓序列不工作

rewrite (*UTF8)^/([\pL\pN\/-]*)$ /index.php?route=$1; 

它使用Perl反斜槓序列匹配所有Unicode字母和數字。

我試圖重現它在Apache:

RewriteRule ^([\pL\pN\/-]*)$ /index.php?route=$1 [QSA,L] 

但它只是斜線和破折號匹配。錯誤日誌很乾淨。

回答

3

mod_rewrite不支持\p屬性,但你可以使用\wBNE標誌,會送你重寫的URI轉義到/index.php

RewriteRule ^([\w/-]+)$ /index.php?route=$1 [QSA,L,B,NE] 

PS:\w還包括下劃線。