从 URL 中删除 'item' 的正则表达式

Regular expression to remove 'item' from URL

我正在尝试重写 URL 来自:

https://www.portal-gestao.com/item/7730-coworking-aproveite-j%C3%A1-todas-as-vantagens-desta-nova-forma-de-trabalhar.html

收件人:

https://www.portal-gestao.com/7730-coworking-aproveite-j%C3%A1-todas-as-vantagens-desta-nova-forma-de-trabalhar.html

这就是我在 .htaccess:

中尝试的
RewriteEngine On
RewriteRule ^.+/item/(.+)$ /item/ [R=301,L]

但是我好像做错了..

您的 URI 以 item 开头,因此 .+/ 不会匹配。使用这个:

RewriteEngine On

RewriteRule ^item/(.+)$ / [R=301,L]