2

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 ?

buzibuzi
  • 724
  • 3
  • 15
  • 27

1 Answers1

2

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.

anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Hi @anubhava, seems to work but now everything under /online-store is redirected to /index.php?option=com_virtuemart. i guess virtuemart router needs to be dealt with – buzibuzi Sep 29 '13 at 17:59
  • This above rule will just redirect `/online-store/inner-store/product-catalog` to `/online-store/product-catalog` after that virtuemart router needs to be dealt. As I suggested Just make sure above rule is first rule in your .htaccess before regular virtuemart router rule. – anubhava Sep 30 '13 at 03:11