V
V
VIRGOS7772020-06-05 22:15:02
htaccess
VIRGOS777, 2020-06-05 22:15:02

When entering a site at the end, you enter any number and the content is pulled up according to the end number, instead of 404. How to fix it?

Good evening!

Tell me, the site is on the Wordpress engine.

So I noticed that:
you enter any number at the end. And according to the idea, it should be 404. (since there is no such content at the address)

But the redirect is pulled up and the content is displayed according to the end number.

Example:

site.ru/1

Then redirect and

site.ru/wp-content/uploads/2018/10/1.jpg

Tell me how to fix it?!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maksym Davydchuk, 2020-06-06
@VIRGOS777

Try writing this in functions.php:

function remove_redirect_guess_404_permalink( $redirect_url ) {
  if ( is_404() && !isset($_GET['p']) )
    return false;
  return $redirect_url;
}

add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );

Or install this plugin. He does the same.

Q
QuestYouCraft, 2020-06-06
@QuestYouCraft

You need to look in the 404.php file of the theme or try to reinstall the WordPress files (without touching the database). Although it is not an exception that the problem may be in the browser (you can try to launch the site on another browser, if the redirect remains - the problem is in the site, if the redirect has disappeared - the problem is in the browser data).

V
VIRGOS777, 2020-06-06
@VIRGOS777

We need to look in the 404.php file
- What exactly do you need to look for?
The file has not changed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question