× Here you can get community support related to ReDJ.

Redirecttion without id

  • kalixo
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 2 weeks ago #4371 by kalixo
Redirecttion without id was created by kalixo
Hello Experts! :)

I did some changes on my site and I found out that I have some stange links indexed.

Example of wrong link:
website.com/4958-articletitle.html
so it is:
website.com/articleID-articletitle.html
and I need to remove this "articleID" from the link. I tried to build that but I don't have this super power ;)


Ps. I will change url suffix option soon, so it will remove the ".html" suffix. Could you please help me with redirect also without suffix .html?

Thanks!

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

More
9 years 2 weeks ago #4376 by admin
Replied by admin on topic Redirecttion without id
Hi,
assuming that for website.com/4958-articletitle.html the CORRECT EXISTING URL is website.com/articletitle.html and assuming that you want to match ALL URLs like website.com/XXXX-articletitle.html the rule should be the following:
From URL: ^/[0-9]+-.*\.html$
To URL: {scheme}://{siteurl}/{preg_match 2}/([0-9]+)-(.*)(\.html)/i{/preg_match}.html
Request only: true (checked)

The rule is "ready to drop .html", just change as follow:
From URL: ^/[0-9]+-.*\.html$
To URL: {scheme}://{siteurl}/{preg_match 2}/([0-9]+)-(.*)(\.html)/i{/preg_match}
Request only: true (checked)

Kind regards,
Luigi
The following user(s) said Thank You: kalixo

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

  • kalixo
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 2 weeks ago #4384 by kalixo
Replied by kalixo on topic Redirecttion without id
Dear Luigi,
thank you so much for the solution! :)
Unfortunatly I realised that It won't be so ease as I thought.

My "old" links were starting as text "article-title-long-name.html"
but I've changed that to "new" links which are just numbers now (based on date): "15110401.html".

So, the correct redirect must include additional condition - I need only to redirect strings that are started by numeric string, and after it there is "-" and than "letters". So, any string which is only numeric (without "-lettes") sould be left without change.

I know it's a liitle bit mess, but is it possible?
Have a nice day!
Thanks in advance,
Kalxo.

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

More
9 years 2 weeks ago #4396 by admin
Replied by admin on topic Redirecttion without id

So, the correct redirect must include additional condition - I need only to redirect strings that are started by numeric string, and after it there is "-" and than "letters". So, any string which is only numeric (without "-lettes") sould be left without change.


It is alredy done like this... :)
The following user(s) said Thank You: kalixo

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

  • kalixo
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 2 weeks ago #4398 by kalixo
Replied by kalixo on topic Redirecttion without id
Thank you!
It worked. Looking on my webmaster tools, I also notices that I have also a lot of 404 with similar urls:

Example of wrong link:
website.com/category/4958-articletitle.html
so it is:
website.com/category/articleID-articletitle.html

and I need to redirect it to:
website.com/category/articletitle

Given soultion doen't include that condition, so could you please add it to this, or write the second?
Thanks. A lot of thanks :)

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

More
9 years 2 weeks ago #4403 by admin
Replied by admin on topic Redirecttion without id
Hi,
just create a rule for each category as follow:
From URL: ^/category/[0-9]+-.*\.html$
To URL: {scheme}://{siteurl}/category/{preg_match 2}/category/([0-9]+)-(.*)(\.html)/i{/preg_match}.html
Request only: true (checked)

Of course, replace any instance of "category" with the real category name (e.g. news).

Kind regards,
Luigi

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

Time to create page: 0.175 seconds