My website has a bunch of URLs like abc.com/[item-id]/[item-name]. Only the item-id is used to display the page, item-name is there only for SEO purposes.

Now, I would like to change that to abc.com/[item-id]/[more-relevant-item-name]. To do this, I have 2 options: 301 redirect and rel=canonical tag. Since only item-id is used to display the page, I can easily go for the canonical tag option by keeping both versions of the page active and setting the second version as canonical, so that search engines would display the second one in the search results. But then the question is: will the ranking of the old URLs be passed to the new, canonical, URLs?

The other option would be to go for 301 redirects, but this would require some ugly conditions in the code that will check if an URL is old and redirect it to the new one if this is the case.

  • What makes those conditions ugly to code? A lot of websites, including this one, do it. It's usually just a couple lines of easy to implement code. – Stephen Ostermiller Sep 19 '20 at 23:48
  • It would be something like "if (old_url_used) then { redirect to new_url }, which is ugly in my opinion. – Vlad Oct 21 '20 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.