E
E
evgenyakut2021-10-01 09:04:45
URL Handling
evgenyakut, 2021-10-01 09:04:45

How to write a complex redirect from one directory to another?

There was a URL like

https://www.lora.ua/posuda/bokali-pitevaya-posuda/$S1/gruppa-tovarov_chashki-i-krujki/$S2/

For example
https://www.lora.ua/posuda/bokali-pitevaya-posuda/vid_chaynie/gruppa-tovarov_chashki-i-krujki/obem_220ml/

which should turn into
https://www.lora.ua/posuda/stolovaya-posuda/$S1/gruppa-tovarov_chashki-i-krujki/$S2/

For example
https://www.lora.ua/posuda/stolovaya-posuda/vid_chaynie/gruppa-tovarov_chashki-i-krujki/obem_220ml/

Everything would be simple if it were not for the URL of the form
https://www.lora.ua/posuda/bokali-pitevaya-posuda/$S1/$S0/$S2/

for example
https://www.lora.ua/posuda/bokali-pitevaya-posuda/material_bogemskoe-steklo/gruppa-tovarov_kuvshini-i-grafini/obem_220ml/
which do not need to be redirected.
Moreover $S1, they may or may not be $S2present and can take on principle any value . changes.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question