Reputation: 734
i need to remove part of Joomla/Virtuemart generated SEF URI using .htaccess the URI represents a menu hierarchy and structured this way:
online-store - inner-store -product-catalog
this is the resulting URI:
www.domain.com/online-store/inner-store/product-catalog
i would like to change it to:
www.domain.com/online-store/product-catalog
thought this might help but its not making any difference
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^online-store/inner-store/\d+-(.+) /online-store/$1 [R=301,L]
i know its not considered good practice but i can't change the menu structure.
any suggestions ?
Upvotes: 2
Views: 345
Reputation: 785481
This regex \d+-(.+)
will match 1 or more digits followed by hyphen followed 1 or more any thing
Try this code instead:
RewriteRule ^(online-store)/inner-store/(.*)$ /$1/$2 [R=301,L,NC]
Make sure this is first rule in your .htaccess
and use a different browser to test it to avoid caching issues.
Upvotes: 2