Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#50490 new defect (bug)

WordPress URL guessing cannot be stopped

Reported by: devrekli's profile devrekli Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.4.2
Component: Permalinks Keywords: reporter-feedback
Focuses: Cc:

Description

Hello. https://wordpress.org/support/topic/how-can-i-remove-redirect/

example:

https://www.ozgurbilgi.net/etiketler/aysegul-tecimer (There is no such link in the site.)

to https://www.ozgurbilgi.net/aysegul-tecimer-ustsuz-danscilar

I tried this

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' );

I tried this

DELETE FROM <code>wp_postmeta</code> WHERE <code>meta_key</code> = '_wp_old_slug'

my htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I tried this

remove_action('template_redirect', 'wp_old_slug_redirect');
remove_filter('template_redirect', 'redirect_canonical');  
remove_action( 'post_updated',      'wp_check_for_changed_slugs',


I searched for it in the database but I couldn’t find it. I do not understand how it redirect.. I tried all this but these did not solve the problem. How can I stop this redirect? thanks

others examples

https://www.ozgurbilgi.net/etiketler/aysun-kayaci to ------> https://www.ozgurbilgi.net/aysun-kayaci-fatih-optu

https://www.ozgurbilgi.net/etiketler/seo to -----> https://www.ozgurbilgi.net/icerik-pazarlamasinda-basarisiz-olmanizin-onemli-nedenleri

I can stop guessing for the normal link but if it gets the prefix (etiketler like this) , the guessing cannot be stopped.

Change History (9)

#1 @devrekli
4 years ago

important: I can stop guessing for the normal link but if it gets the prefix (etiketler like this) , the guessing cannot be stopped.

#2 @SergeyBiryukov
4 years ago

  • Keywords reporter-feedback added

Hi there, welcome to WordPress Trac! Thanks for the report.

I tried this

Any of those options should have worked under normal circumstances. Does the issue still happen with all plugins disabled and a default theme (Twenty Twenty) activated?

WordPress 5.5 will offer better fine-grained control of redirect_guess_404_permalink(), see #16557 for more details.

#3 @devrekli
4 years ago

@SergeyBiryukov

I have tried it now. The problem continues.

this time, link redirects to a similar picture. these should go to the 404 page.

If there are normal links, these options work. If it gets the prefix, these options don't work.

thanks

Last edited 4 years ago by devrekli (previous) (diff)

#5 @apedog
4 years ago

I've had a similar issue when debugging 404/redirects on my local machine. I think 404 headers get cached and refresh doesn't help.

The gist of it was if at any point while testing, I made the url to return a 404 - the browser would keep treating the url as a 404 - even if I changed it later. The 404 header is cached (i think) and the browser does not attempt a reload.

Opening the browser's devtools and setting 'disable cache' will force new headers on every refresh.

#6 @devrekli
4 years ago

@SergeyBiryukov

you can help me? please thanks

#7 @SergeyBiryukov
4 years ago

Please note that this Trac is used for enhancements and bug reporting for the WordPress core software, not for individual support questions.

Please continue with your topic on the support forums to get help with your site.

this time, link redirects to a similar picture. these should go to the 404 page.

If you have an image with a slug of seo uploaded to a post with a slug of etiketler, then /etiketler/seo/ is the expected permalink of that image (as seen in the video), I don't see a bug here.

If there is still a bug, then some clear steps to reproduce it on a clean install would be helpful.

#8 @devrekli
4 years ago

@SergeyBiryukov

I think this is a bug. Because There is no link on the site named "etiketler".... The word "etiketler" doesn't matter here. It can be any other word.

That is not the permalink for "seo".

right permalink in the example https://www.ozgurbilgi.net/icerik-pazarlamasinda-basarisiz-olmanizin-onemli-nedenleri/seo

Last edited 4 years ago by devrekli (previous) (diff)

#9 @devrekli
4 years ago

It makes this redirect always. Other examples. I'm using nonsense words

https://www.ozgurbilgi.net/dsdsdsetiketlerdsdsdsdsdsdsdsdsdsdsdsds/seo
https://www.ozgurbilgi.net/11121113cczc22s/seo

I can remove guess redirects for normal link. if it gets the prefix, what we do is not working.

these links should be 404. thanks

Note: See TracTickets for help on using tickets.