1

I'm trying to write a rule to transform a group of URLs. Two examples

  1. /catalog/product/view/id/4411/s/tall-slim-vase/category/186/
    

    should become

    /tall-slim-vase.html
    
  2. /catalog/product/view/id/4449/s/cream-rose-basket/category/209/
    

    should become

    /cream-rose-basket.html
    

I have many URLs like this. Can I rewrite all of them using a single rule?

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
grazza1977
  • 23
  • 3
  • I think this is a related question http://stackoverflow.com/questions/990392/htaccess-rewrite-to-redirect-root-url-to-subdirectory?rq=1 – Roman Jun 14 '16 at 14:30

1 Answers1

0

You take the part between /s and /category/ ? Regular expressions will help you in this. You can use something like RegexTester to test your code and examples.

The rule may be something like:

"/catalog/product/view/id/####/s"{stuff you need}"/category/###/" Then you take the {stuff you need} and add .html to it

Roman
  • 1,727
  • 1
  • 20
  • 28