× Here you can get community support related to ReDJ.

adding a letter or changing the path

  • derekk
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 7 months ago #5624 by derekk
adding a letter or changing the path was created by derekk
We have a lot of links written as
homehighschoolhelp.com/blog/what-are-social-sciences

We need these to add an "s" to the word "blog" in each url
homehighschoolhelp.com/blogs/what-are-social-sciences

How would we write this in Redj?

Thank you

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

More
7 years 6 months ago #5628 by admin
Replied by admin on topic adding a letter or changing the path
Hi,
try this rule (literally)
From URL: ^/blog/
To URL: {scheme}://{siteurl}/blogs/{pathltrim /blog/}{queryfull}
Request only: true (checked)

Kind regards,
Luigi

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

  • derekk
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago - 7 years 6 months ago #5633 by derekk
Replied by derekk on topic adding a letter or changing the path
Thank you Luigi once again you nailed it!

I tried about 5 different variations before but I completely missed the concept of pathtrim.
I had the "From URL" perfect however I assumed in the "To URL" it would trim the url by itself without the pathtrim syntax.
I had it written as {scheme}://{siteurl}/blogs/{queryfull}
Now I realize from your rules that, in the "To URL" you must first instruct it to add the "s" with
"{scheme}://{siteurl}/blogs/" then instruct it to remove the original "blog" from the url with "{pathltrim /blog/}".
I do not yet understand what "{queryfull}" does.
I assume it is an instruction to query the entire URL not just part of it.
I will research it in your documentation.

Anyway thank you and now that I comprehend it more I should not have to bother you as much in the future.
Last edit: 7 years 6 months ago by derekk.

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

More
7 years 6 months ago #5636 by admin
Replied by admin on topic adding a letter or changing the path
Hi.
The {queryfull} macro returns the original query string. In this way your target URL will "preserve" any parameter of the original source. Consider that ALL macros works on the "current source URL" the rule matchs for...

You can find a list of macros in the "edit" rule form under last tab.

Kind regards,
Luigi

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

  • derekk
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago #5643 by derekk
Replied by derekk on topic adding a letter or changing the path
Thank you very much Luigi

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

More
7 years 6 months ago #5648 by admin
Replied by admin on topic adding a letter or changing the path
You are welcome, Derek.

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

Time to create page: 0.104 seconds