Extract data from within an URL
-
cappu
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 8
-
Thank you received: 0
-
-
10 years 1 month ago #3205
by cappu
Hi Luigi,
I need you help.
I have hundreds of From-URL like this:
/ihresuche..Bischafsheim%20(bei%20R%c3%bcsselheim)..php
I want to redirect to this
/tierspezialistensuche?searchstring=Bischafsheim%20(bei%20R%c3%bcsselheim)
Where "Bischafsheim%20(bei%20R%c3%bcsselheim)" could be any string with any length.
Ideal would be a a ltrim of "/ihresuche.." and a rtrim of "..php"
Thanks for any ideas
Kind regards,
Bernhard
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
10 years 1 month ago #3207
by admin
Hi Bernhard,
assuming th ".." are real (if not this will not work), try this:
From URL: ^/ihresuche\.\.
To URL: {scheme}://{siteurl}/tierspezialistensuche?searchstring={preg_match 1}/\/ihresuche\.\.(.*)\.\.php$/i{/preg_match}
Request only: true (checked)
Kind regards,
Luigi
Please Log in or Create an account to join the conversation.
-
cappu
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 8
-
Thank you received: 0
-
-
10 years 1 month ago #3210
by cappu
Hi Luigi,
it works! Thank you so much! - This is awesome.
BTW: Did you consider to change the field "To URL *" to an textarea? - For larger Regex statements a textfield is hard to read.
Kind regards,
Bernhard
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
10 years 1 month ago #3211
by admin
Yes,
is in my plans, but consider that using placeholders allow to have a very short "To URL", and this is why I postponed this change.
Kind regards,
Luigi
Please Log in or Create an account to join the conversation.
Time to create page: 0.171 seconds