2017-04-13 72 views

回答

1

我似乎找到了規律:

# Rewrite old URLs with category IDs in the middle 
RewriteRule ^(.*)(-[0-9]+)\/(.*) $1/$3 [R=301,L,R] 

至少它爲我工作。

現在我使用這條規則也剝奪了數以URL的末尾:

# Rewrite old URLs with category IDs at the end 
RewriteCond %{REQUEST_URI} ^(.*)(-[0-9]+)$ 
RewriteRule .* %1 [R=301,L] 

# Rewrite old URLs with category IDs in the middle 
RewriteRule ^(.*)(-[0-9]+)\/(.*) $1/$3 [R=301,L,R]