section/cat/254-a-name to section/cat/a-name
-
Stef
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 8
-
Thank you received: 0
-
-
-
-
-
-
Stef
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 8
-
Thank you received: 0
-
-
-
-
-
7 years 7 months ago - 7 years 7 months ago #6078
by Stef
Last edit: 7 years 7 months ago by Stef.
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
7 years 7 months ago #6080
by admin
Try this:
From URL: ^/section/category/[0-9]+-
To URL: {scheme}://{siteurl}/section/category/{preg_match 1}/\/section\/category\/[0-9]+-([^\/]+)/{/preg_match}
Request only: true (checked)
Note: Macro preg_match works only for Enterprise version.
Kind regards,
Luigi
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
7 years 7 months ago #6081
by admin
This will work also for
www.mysite.com/section/anothercategory/subcategory/527-a-anothername:
From URL: ^/section/
To URL: {scheme}://{siteurl}/section/${a}/${b}
Request only: true (checked)
Placeholders:
a={preg_match 1}/\/section\/(.*)\/[0-9]+-([^\/\?]+)/{/preg_match}
b={preg_match 2}/\/section\/(.*)\/[0-9]+-([^\/\?]+)/{/preg_match}
Kind regards,
Luigi
The following user(s) said Thank You: Stef
Please Log in or Create an account to join the conversation.
-
Stef
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 8
-
Thank you received: 0
-
-
-
-
-
7 years 7 months ago - 7 years 7 months ago #6082
by Stef
Hi Luigi,
Thanks for the 'How to'.
A made some changes to fit my needs...
From URL
I added some regex to be sure that the redirection will apply on items and not list views (/section - section/category - section/category/subcategory are Search & List view from Seblod). So it give :
\/section\/(.*)\/([0-9]{1,3}-.*)
It works well - I'm just not sure if it is the simplest way...
BTW, I found a really good tool to help who like me are just discovering regex :
regex101.com
Really helpful to see what the regex is actually selecting in your string with clear explanation. 2 Thumbs Up for this one
Last edit: 7 years 7 months ago by Stef.
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
7 years 7 months ago #6083
by admin
Hi Stef,
thank you for reporting, I am glad it worked.
Best regards,
Luigi
Please Log in or Create an account to join the conversation.
Time to create page: 0.144 seconds