× Here you can get community support related to ReDJ.

Complex Redirect Rule

  • donald
  • Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 6 months ago #6925 by donald
Replied by donald on topic Complex Redirect Rule
Hi Luigi,

1) I think you misunderstood my #1 question. Yes, I do know that I need a \ to display the next character correctly, but the question was about the output URL which contains a \ that shouldn't be there.

2) You're right. What you have mentioned does work, but unfortunately, it will break my other rules. I have attached my rules that currently work, and I don't want to break them. So I was hoping I get a specific matching pattern that work only on the URLs i'm trying to change.

3) Lastly, what is a pattern i can use to match URLs that have 1 to 5 digit number followed by a '-' then followed by text.
Ex. /directory/london/food/restaurants-catering/4745-ali-baba-pita-wrap


Thanks,
Donald
Attachments:

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

More
5 years 6 months ago #6927 by admin
Replied by admin on topic Complex Redirect Rule
Hi Donald,
about the first question, I stil don't understand what / are you talking, there are a lot. Please write the URL again a highlight the piece you want to submit to my attention.
About the second request, I can't do this from a not-so-clear image. Just tell me the URL you want to match, highlight the piece to preserve and I will try to build a matching rule.
Point 3 is easy (how lucky...). It can be put into regexp like this:
/directory/london/food/restaurants-catering/[0-9]+-

Kind regards
Luigi

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

  • donald
  • Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #6930 by donald
Replied by donald on topic Complex Redirect Rule
Hi Luigi,

Thanks for your quick response.


For #3) Your solution works! Thanks!


For #1) I tried explaining it earlier (see screenshot here: prntscr.com/lbvf8h ) where this '/' (shown by the red arrow in screenshot) displays when I use the pattern:
{scheme}://{siteurl}/directory/${city}/${cat}/${subcat}/all\?cf43[0]=${city}

I do understand that the \ is used to escape the '?' but I am not understanding why I am getting a '\' in the finished URL before the '?' mark.

Give it a try yourself, go to: muslimlink.ca/directory/london/food/restaurants-catering/all and see how it converts to:
muslimlink.ca/directory/london/food/restaurants-catering/all/?cf43[0]=london.

This is the exact rule I'm using: prntscr.com/lbvjhg


For #2) Currently these are the rules set up in this exact order:

1) ^/directory/.*/all$ becomes {scheme}://{siteurl}/directory/${city}/${cat}/${subcat}/all\?cf43[0]=${city}
2) ^/directory/.*/visit$ becomes {scheme}://{siteurl}{pathrtrim /visit}{queryfull}
3) ^/directory/.*/all/page.*/ becomes {scheme}://{siteurl}/directory/${city}/${cat}/${subcat}/all/page${page}\?cf43[0]=${city}
4) ^/directory/.*/page.* becomes {scheme}://{siteurl}/directory/${city}/${cat}/${subcat}/all/page${page}\?cf43[0]=${city}
5) ^/directory/.*/[0-9]+- becomes {scheme}://{siteurl}/directory/${city}/${cat}/${subcat}/${buz}?city=${city}

The rule I want to add needs to change URL from (as an example):
/directory/london/babies-children/clothing-accessories/
/directory/london/babies-children/clothing-accessories
to become:
/directory/london/babies-children/clothing-accessories/all?cf43[0]=london

Your previous solution (which was "From URL: ^/directory/"), breaks some of the above (even when I order it at the bottom). I need to make sure it doesn't break any of the above, and also happens ONLY when the URL has a city, a category and a subcategory
(in previous example: city=london, category=babies-children, subcategory=clothing-accessories).

So basically the following urls should NOT be affected by this new rule:
  • /directory
  • /directory/london
  • /directory/london#Food
  • /directory/london/food/restaurants-catering/all
  • /directory/london/food/restaurants-catering/all?cf43[0]=london
  • /directory/london/food/restaurants-catering/all/page2
  • /directory/london/food/restaurants-catering/all/page2?cf43[0]=london
  • /directory/london/food/restaurants-catering/4745-ali-baba-pita-wrap
  • /directory/london/food/restaurants-catering/4745-ali-baba-pita-wrap?city=london

It should ONLY affect the URLs:
  • /directory/london/food/restaurants-catering/
  • /directory/london/food/restaurants-catering

(NOTE: I'm using city="london", cat="food" and subcategory="restaurants-catering" as examples only. It should allow any city, cat or subcat).

I hope I am clear now.

Thank you!

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

  • donald
  • Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago #6938 by donald
Replied by donald on topic Complex Redirect Rule
Any updates? If you lack time, at least answer #2 for now as that is the blocker.

Thank you!! :)

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

  • donald
  • Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 4 months ago #6966 by donald
Replied by donald on topic Complex Redirect Rule
Hope you're enjoying your holidays.

Please let me know if you plan to work on this, or should I just find another way around my issue?

Thanks,
Donald

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

More
5 years 4 months ago #6977 by admin
Replied by admin on topic Complex Redirect Rule
Hi Donald,
sorry for delay but I am crazy busy with my new job and some personal stuffs that must be managed. I tried to recall the problem so I had to read the whole thread again.

About the point 2, if you trace the network requests you will see more redirects:

muslimlink.ca/directory/london/food/restaurants-catering/all

Is redirected (301) to:

muslimlink.ca/directory/london/food/restaurants-catering/all\?cf43[0]=london

And another redirect (301) to:

muslimlink.ca/directory/london/food/restaurants-catering/all/?cf43[0]=london

So there is a problem with the rule, because the first redirect is wrong. The combination \? should be present in the "From URL" as regular expression literal, and not in the "Target URL" as part of destination URL.

About the point 3:

So basically the following urls should NOT be affected by this new rule:

/directory
/directory/london
/directory/london#Food
/directory/london/food/restaurants-catering/all
/directory/london/food/restaurants-catering/all?cf43[0]=london
/directory/london/food/restaurants-catering/all/page2
/directory/london/food/restaurants-catering/all/page2?cf43[0]=london
/directory/london/food/restaurants-catering/4745-ali-baba-pita-wrap
/directory/london/food/restaurants-catering/4745-ali-baba-pita-wrap?city=london

It should ONLY affect the URLs:
/directory/london/food/restaurants-catering/
/directory/london/food/restaurants-catering


Honestly I can't see a way to do this with a single rule, because I can't find a common pattern or a common exclusion pattern. You could try to create a rule for the /all end and another one for the /4725-xxx end.

Kind regards
Luigi

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

Time to create page: 0.099 seconds