Opened 8 months ago
Last modified 7 months ago
#60330 new defect (bug)
redirect that working incorrectly!
Reported by: | markuscode | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Rewrite Rules | Keywords: | |
Focuses: | Cc: |
Description
Issues that once you going to for example https://example.com/example-page-slug/1000/ will redirect you to https://example.com/example-page-slug/ . But it's supposed to display 404 page. Is bad for SEO because that redirect using 301.
<?php class RedirectFixer { function __construct(){ add_filter('request', array($this, 'request'),10,1); } function request($query) { if(isset($query['page']) && (int)$query['page'] > 0) { $query = array( 'pagename' => '404' ); } return $query; } } new RedirectFixer();
This is how to fix it.
Change History (4)
Note: See
TracTickets for help on using
tickets.
I gave it a go myself, and I'm seeing the same behaviour as you reported. URLs like https://example.com/example-page-slug/1000/ are redirecting to https://example.com/example-page-slug/ instead of showing a 404 page. That 301 redirects isn't doing our SEO any favours.
Environment