× Here you can get community support related to ReDJ.

Redirect urls with trimed numbers

  • lorenco
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 6 months ago - 7 years 6 months ago #5685 by lorenco
Redirect urls with trimed numbers was created by lorenco
Hi,

at first, thank you so much for such great extension, it solved us a lot of issues,
have a small question, we have such articles urls:
mydomain.com/myblog/mycategory/234-sample-article-2-everyone
mydomain.com/myblog/mycategory/7-welcome-to-my-blog
mydomain.com/myblog/mycategory/43-today-news
so those numbers:
234-
7-
43-
actually are article ids,

i want those urls redirect to (those urls already exists on my site, so i have duplicate pages with different urls):
mydomain.com/myblog/mycategory/sample-article-2-everyone
mydomain.com/myblog/mycategory/welcome-to-my-blog
mydomain.com/myblog/mycategory/today-news
so i want to redirect urls without article id numbers for fixing duplicate content issue on my site,
i have many such articles, i don't want to add redirection on each time when the new article will be added, i want to match with regular expression article ids in url and redirect them to new urls without article id numbers,
how to achieve that with one single redirect?

Best Regards,
Lorenco
Last edit: 7 years 6 months ago by lorenco.

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

More
7 years 5 months ago #5689 by admin
Replied by admin on topic Redirect urls with trimed numbers
Hi Lorenco,
this rule should work, but it required the Enterprise edition of ReDJ:
From URL: ^/myblog/mycategory/
To URL: {scheme}://{siteurl}/myblog/mycategory/{preg_match 1}/\/myblog\/mycategory\/[0-9]+-(.*)$/i{/preg_match}
Request only: true (checked)

Kind regards,
Luigi

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

Time to create page: 0.081 seconds