2

我需要使用 .htaccess 删除 Joomla/Virtuemart 生成的 SEF URI 的一部分,该 URI 表示菜单层次结构并以这种方式构造:

在线商店-内部商店-产品目录

这是生成的 URI:

www.domain.com/online-store/inner-store/product-catalog

我想将其更改为:

www.domain.com/online-store/product-catalog

认为这可能会有所帮助,但没有任何区别

Options +FollowSymLinks
RewriteEngine On    

RewriteRule ^online-store/inner-store/\d+-(.+) /online-store/$1 [R=301,L]

我知道这不是好的做法,但我无法更改菜单结构。

有什么建议么 ?

4

1 回答 1

2

此正则表达式\d+-(.+)将匹配 1 个或多个数字后跟连字符后跟 1 个或多个任何东西

试试这个代码:

RewriteRule ^(online-store)/inner-store/(.*)$ /$1/$2 [R=301,L,NC]

确保这是您的第一条规则,.htaccess并使用不同的浏览器对其进行测试以避免缓存问题。

于 2013-09-29T17:02:51.210 回答