R
R
Rail Khamdeev2017-07-28 15:19:37
htaccess
Rail Khamdeev, 2017-07-28 15:19:37

Wordpress returns 200 for invalid category links. How to fix?

Good afternoon!
In the process of repairing the client site, I encountered such a problem that WordPress processes incorrect links to categories and returns a 200 response on them and the content of the category whose address is left at the end of the address.
To make it clearer, I will give an example on a standard WordPress site without third-party plugins and with a default theme.
Here is a section with the code all and the name "About the car"
Here is a link to this section - https://2112.hamdeew.ru/category/all/ .hamdeew.ru/category/hi-toster/all/ And even like this - https://2112.hamdeew.ru/category/wtf/test/broken/l...
But in the blog post example, incorrect links are automatically fixed and redirected to the correct content:
https://2112.hamdeew.ru/tst/tst/tst/2013/06/buy... -> https://2112.hamdeew .ru/2013/06/bought-butter/
Guys, is this a bug or a feature? And how to treat it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Arman, 2019-02-25
@Arik

https://github.com/h5bp/server-configs-apache/blob...
only your own protocol can be specified

D
dodo512, 2019-02-25
@dodo512

RewriteCond %{HTTP_HOST} ^www.xn------6cdbb3azdvbfjfjeedepxgkdiodhc9gqe5d5a2j.xn--p1ai/$ [NC]

In the %{HTTP_HOST} variable, only the domain and there is none. /
In the template /$, you need to remove / here.

V
Viktor Taran, 2019-02-25
@shambler81

And who will screen the points for you?
and who will put the protocol in the steering wheel for you?

W
WordPress WooCommerce, 2017-07-28
@maxxannik

This is the specifics of adaptive content and the mechanics of Rewrite Rules with flexible endpoints and query vars.
This usually does not create problems. And apparently because no one climbs there.
If the site is public and SEO is needed, then most likely this is solved through the canonical meta tag, which automatically gets up correctly if you install the SEO Yoast plugin or some other SEO plugin.
If Pts is annoying, then you can add a 301 redirect or 404 error through the template_redirect hook.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question