I have WordPress blog with permalink /%category%/%postname%

it is OK when i have one category.

but when I add another, the post is available with two URL and i think its bad for seo

for Example:



This post is in two URLs. I prefer the first one. How can i do this?

1 Answer 1


In this case you want to set a canonical URL to tell search engines that the content is duplicated over more than one URL. The canonical URL is a <link> tag which appears in the <head> of your page, for example:

<link rel="canonical" href="https://example.com/Tourism/astara/museum-customs-home-belgians" />

You want to use this same URL for each of the different category URLs, telling search engines which is the main source post.

The easiest way to do this is using a plugin, such as Wordpress SEO. They also have a Knowledge base article which will help you to set these up for your posts.

  • Thanks , Canonical is good way, but I don't need the second URL. can I add code to show only first category(not sub-category)? I use yoast seo Commented Apr 25, 2019 at 16:56
  • You can take a look at the answer here which has a code snippet you could try. It changes the post slug to use just the parent term in the URL. Commented Apr 25, 2019 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.