× Here you can get community support related to ReDJ.

Changing the path with ReDJ

  • davy7125
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #5987 by davy7125
Changing the path with ReDJ was created by davy7125
Hello,

It's been a while that I'm stuck on a simple problem. I'd like to redirect this:
{www.mysite.com}/en/soundfonts/search/search-by/{XXX}
into this :
{www.mysite.com}/en/files/soundfonts/search-by/{XXX}

What is in {} should remain, only the middle part will change. I tried to use this placeholder ({search} should be the rest of the url):

a={path}
search={preg_match 1, a}search-by/(.*$)/i{/preg_match}

but no luck.

Regards,
Davy

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

More
7 years 1 month ago #5988 by admin
Replied by admin on topic Changing the path with ReDJ
Hi Davy,
this seems simpler than you think:
From URL: /en/soundfonts/search/search-by/
To URL: {scheme}://{siteurl}/en/files/soundfonts/search-by/{pathltrim /en/soundfonts/search/search-by/}
Request only: true (checked)

Kind regards,
Luigi
The following user(s) said Thank You: davy7125

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

  • davy7125
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #5989 by davy7125
Replied by davy7125 on topic Changing the path with ReDJ
Thank you for the answer, it works

I had an extra constraint to take into account: sometimes I have for example "/en/soundfonts/keyboards/pianos/search-by" to redirect also. I understand the plugin better now and I used the following configuration (that works):
From URL: ^/en/soundfonts/.*/search-by/
To URL: {scheme}://{siteurl}/en/files/search-by/{pathfolder last-1}/{pathfolder last}
Request only: true (checked)

I couldn't use the following line, maybe there is a bug:
To URL: {scheme}://{siteurl}/en/files/search-by/{pathfrombaseltrim /search-by/}

I have the enterprise edition and according to the documentation here I would have expected to retrieve the string following "/search-by/", whatever there is before "/search-by/". Instead of this, "{pathfrombaseltrim /search-by/}" is replaced by the whole path.

Regards,
Davy

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

More
7 years 1 month ago #5990 by admin
Replied by admin on topic Changing the path with ReDJ
Hi Davy,
te macro pathfrombaseltrim takes as param the whole part to drop from the base path. In your case the base path and the path are the same, because Joomla is not installed on a sub-folder. You should use:.

{pathfrombaseltrim /en/soundfonts/<fixed>/search-by/}

But is not possible in your case (no fixed there). So, if your solution doesn't work, we can use preg_match, because you have the Enterprise version.

Kind regards,
Luigi
The following user(s) said Thank You: davy7125

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

  • davy7125
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 1 month ago #5991 by davy7125
Replied by davy7125 on topic Changing the path with ReDJ
Thank you for these explanations :)
For now, since everything is working, I'll keep using "pathfolder". I will use "preg_match" in the future if I have other requirements.

Regards,
Davy

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

More
7 years 1 month ago #5993 by admin
Replied by admin on topic Changing the path with ReDJ
U're welcome now and always Davy.

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

Time to create page: 0.137 seconds