尝试这个
<IfModule mod_rewrite.c>
RewriteEngine on
#1 www.example.com/1/abc to www.example.com/page/1/name/abc (/number/string)
RewriteRule ^([0-9]+)/([^/]+)$ /page/$1/name/$2 [L,QSA]
#2 www.example.com/la/abc to www.example.com/city/la/name/abc (/string/string)
RewriteRule ^([^/]+)/([^/]+)$ /city/$1/name/$2 [L,QSA]
#3 www.example.com/1/abc/la to www.example.com/page/1/name/abc/city/la (/number/string/string)
RewriteRule ^([0-9]+)/([^/]+)/([^/]+)$ /page/$1/name/$2/city/$3 [L,QSA]
#4 www.example.com/1/ to www.example.com/page/1/ (/number/)
RewriteRule ^([0-9]+)/$ /page/$1/ [L,QSA]
</IfModule>
规则顺序非常重要。不要换。规则 1 必须始终在规则 2 之前。规则 4 必须始终在最后。顺序是从最具体到最通用的规则。规则 3 可以在任何位置,但在规则 4 之前。