Stuck on a search redirect format
-
Im so stuck on this one, been testing me now for the last 4+ hours so im here to ask for advice ??
Im trying to redirect two urls as below
/search-images/nggallery/tags/alton
/search-images/nggallery/tags/axe-edgeTo the wrdpress search, the structure im after is for the above 2 URLS is
/?s=alton&post_type=product
/?s=axe edge&post_type=productI initially tried to do both on one redirect, but couldn’t… so decided to try and do one at a time. I’m not sure if this is the right way to do it (advice welcomed)
The first one was easy enough
^/search-images/nggallery/tags/(.[a-zA-Z]*)$
/?s=$1&post_type=product
Works a treat, i did it that way so I could then tackle the second type of URL that contains the – between the two words “axe-edge” in this instance and I came up with this
^/search-images/nggallery/tags/(.*)-(.*)
/?s=$1 $2&post_type=productAgain works great on https://regex101.com/ when testing, but when testing on wordpress site it is removing the – as should and joining the 2 words like this
/?s=axeedge&post_type=product
it needs to be
/?s=axe edge&post_type=product
Ive tried adding in, %20 (%20) “%20” any ideas would be very much appreciated
- The topic ‘Stuck on a search redirect format’ is closed to new replies.