× Here you can get community support related to ReDJ.

Category, id, title redirect

  • womensagenda
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 5 months ago #4428 by womensagenda
Category, id, title redirect was created by womensagenda
Hi,

I'm trying to redirect the following types of url:

www.website.com/category1/subcategory2/original-article-title-goes-here/201503095419
www.website.com/category3/subcategory4/article-title/20120724145

to

www.website.com/category1/subcategory2/5419-original-article-title-goes-here
www.website.com/category3/subcategory4/145-article-title

The original link has a 9-13 character string at the end of it. The first 8 characters are a datestamp that I don't need to use. The remaining 1-4 characters are the Joomla article ID.

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

  • womensagenda
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 5 months ago #4429 by womensagenda
Replied by womensagenda on topic Category, id, title redirect
So far, I have the following (attached in screenshot)

Placeholders:
id=5419
or
id=145

This gives me the result:
www.website.com/categoryX/subcategoryY/item/5419-original-article-title-goes-here-

I cannot get it to use a dynamic ID in the placeholder, and it is adding an extra hyphen at the end of the alias that I'd like to tidy up.

What I've been trying to do is return a substring of from the 9th character onwards of that end-of-url string, and use the returned value in the placeholder. Is this possible?
Attachments:

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

More
8 years 5 months ago #4430 by admin
Replied by admin on topic Category, id, title redirect
Hi,
I will help you to fix the rules, but first I need to understand something.

I'm trying to redirect the following types of url:

www.website.com/category1/subcategory2/original-article-title-goes-here/201503095419
www.website.com/category3/subcategory4/article-title/20120724145

to

www.website.com/category1/subcategory2/5419-original-article-title-goes-here
www.website.com/category3/subcategory4/145-article-title


If you need to redirect a single old URL to a single new URL there's no need to use placeholders. So I guess you have a lot of old URLs. Is it so?

In this case, could you please copy a couple of old->new? I need to find a common pattern to build up a rule.

Thanks,
Luigi

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

  • womensagenda
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 5 months ago #4431 by womensagenda
Replied by womensagenda on topic Category, id, title redirect
Here are a couple of examples:

/career-agenda/inspiring-women/jane-kennedy/20120724145
to
/career-agenda/inspiring-women/item/145-jane-kennedy

and

/talking-about/top-stories/dr-gabrielle-mcmullin-clarifies-junior-doctors-need-support-fighting-harassment/201503095419
to
/talking-about/top-stories/item/5419-dr-gabrielle-mcmullin-clarifies-junior-doctors-need-support-fighting-harassment


We do have a lot of old->new URLs, the number may be in the thousands. The IDs of the articles could be either 3 or 4 digits.

I can PM you a large list of old URLs if that will help?

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

More
8 years 5 months ago - 8 years 5 months ago #4434 by admin
Replied by admin on topic Category, id, title redirect
Hi,
the problem is that the id=145 in 145-jane-kennedy is needed for the destination to work, but is not present in the source url.

So to build the rule to redirect:

/career-agenda/inspiring-women/jane-kennedy/20120724145
to
/career-agenda/inspiring-women/item/145-jane-kennedy

You should first extract the jane-kennedy, use it to lookup the table for the id (if possible) and get the id 145, then use this to build up the destination.

Is it clear?
Last edit: 8 years 5 months ago by admin.

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

  • womensagenda
  • Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 5 months ago #4454 by womensagenda
Replied by womensagenda on topic Category, id, title redirect
Your suggestion worked a treat, thank you Luigi!

Seems like I was SO close but just looking in the wrong direction ;)

Thank you muchly!

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

Time to create page: 0.081 seconds