Changing the path with ReDJ
-
davy7125
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 3
-
Thank you received: 0
-
-
7 years 8 months ago #5987
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.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
7 years 8 months ago #5988
by admin
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
-
Less
More
-
Posts: 3
-
Thank you received: 0
-
-
7 years 8 months ago #5989
by davy7125
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.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
7 years 8 months ago #5990
by admin
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
-
Less
More
-
Posts: 3
-
Thank you received: 0
-
-
7 years 8 months ago #5991
by davy7125
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.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
Time to create page: 0.147 seconds