× Here you can get community support related to ReDJ.

complicated redirect - using placeholder?

  • BodgeIT
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 2 months ago #3569 by BodgeIT
Hi Luigi,
I've been trying so many different ways to get this redirect right and just not getting it.

I want to convert
/index.php/hen-parties/hen-party-cities/manchester-hen-parties

to
/tcc/hen-and-stag-parties/locations/manchester-hen-party-dance-classes

I think I need to create a placeholder to remove -hen-parties to get city then add the rest is that right?

Please Log in or Create an account to join the conversation.

  • BodgeIT
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 2 months ago #3571 by BodgeIT
Replied by BodgeIT on topic complicated redirect - using placeholder?
Here are my placeholders so far:
path={pathltrim /index.php/hen-parties/hen-party-cities/}
city={str_replace '-hen-parties','hen-party-dance-classes'}${path}{/str_replace}

Please Log in or Create an account to join the conversation.

  • BodgeIT
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 2 months ago #3572 by BodgeIT
Replied by BodgeIT on topic complicated redirect - using placeholder?
Here is my match:
^/index.php/hen-parties/hen-party-cities/
and replace:
{scheme}://{siteurl}/tcc/hen-and-stag-parties/dance-classes/locations/${city}
Here are my placeholders so far:
path={pathltrim /index.php/hen-parties/hen-party-cities/}
city={str_replace '-hen-parties','hen-party-dance-classes'}${path}{/str_replace}

What I'm finding is a bit inconsistent.

Sometimes the pathltrim is being used, sometimes not i.e.
/tcc/hen-and-stag-parties/dance-classes/locations//index.php/hen-parties/hen-party-cities/nottingham-hen-party-dance-classes
or
/tcc/hen-and-stag-parties/dance-classes/locations/$city-hen-party-dance-classes

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #3574 by admin
Replied by admin on topic complicated redirect - using placeholder?
I'm sorry this is making you crazy but happy you are playing with placeholders. :)

Anyway, placeholders are useful when you need to make complex transformations. In your example you have a classic one-on-one redirect:

I want to convert
/index.php/hen-parties/hen-party-cities/manchester-hen-parties

to
/tcc/hen-and-stag-parties/locations/manchester-hen-party-dance-classes


Why do you need placeholders?

Please Log in or Create an account to join the conversation.

  • BodgeIT
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 2 months ago - 9 years 2 months ago #3576 by BodgeIT
Replied by BodgeIT on topic complicated redirect - using placeholder?
Couldn't work out how else to combine pathltrim and pathrtrim(tried that first)/str_replace

I guess I could use regexp to get content after last / but regexp make my head explode
Last edit: 9 years 2 months ago by BodgeIT.

Please Log in or Create an account to join the conversation.

  • BodgeIT
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 2 months ago - 9 years 2 months ago #3577 by BodgeIT
Replied by BodgeIT on topic complicated redirect - using placeholder?
Also this isn't a 1on1. This is a group redirect.

Sorry I wasn't clear.

The link above is one of 40 that start /index.php/hen-parties/hen-party-cities/

I forgot that I modded the trigger url to make sure I was "triggering" the redirect because of the inconsistencies.

So I need to be able to change the first bit, grab the city name out of the second bit and then append a new string to the end.
Last edit: 9 years 2 months ago by BodgeIT.

Please Log in or Create an account to join the conversation.

Time to create page: 0.118 seconds