1
votes

I have very unusual issue on my WordPress website. In most of the blog posts custom permalink is working but there are few posts which are not following permalink structure like following

This is the correct link structure to open the blog post : https://www.knexusgroup.com/show/blog/how-to-win-at-real-time-marketing/

But you can access this blog post like following URL also : https://www.knexusgroup.com/how-to-win-at-real-time-marketing/

Blog posts which are correct, when you remove /show/blog/ from URL it will reflect 404 error, but in this blog post, it is opening the blog post.

Can anyone help me here to understand the issue & how to resolve this?

Edit 1

I have found what is the problem, and is post attachment & post have same post_name. However this should be resolved by solution How to delete the permalink (landing pages) of image in the media library in Wordpress?

But this is not working in this scenario. We are using permalink structure /show/blog/%postname%/ and I've observed which posts have permalink structure, there is no edit option in media attachment.

2
Maybe WP has cached old URLs from when before you changed to this specific permalink format? - CBroe
I cleared all cache. And this URL structure is running from a very long time. I identified this issue early last month but not able to resolve. Seems very unusual kind of issue. - Jaswant Singh
Well since canonical still seems to be set correctly even if the page is requested via the “wrong” URL, there is not that much of an issue here to begin with. I’d check the .htaccess and search the database for the “wrong” URL (the path portion of it), to see if it shows up anywhere in there maybe. - CBroe
@CBroe Can help me here with SQL query to search what? I am not sure how to get on here. - Jaswant Singh
Not talking about writing any queries manually, but something like phpMyAdmin’s search functionality. - CBroe

2 Answers

1
votes

With idea of comment, I and Jaswant came to know attachment have same post-name as parent post.

So we deleted attachment of that post by searching in media library, and re added attachment to post, it works, this also fixed permalink of attachment with custom permalink and parent post.

I found all duplicate URL by running MySQL query.

0
votes

Look into the parent page for each of yours pages. if the parent page is "show" so the link will be show/yout-page.

I hope I've helped you