WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 months ago

#38275 closed defect (bug) (duplicate)

Single wildcard character in .htaccess requests any page

Reported by: martinthehorrible Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Permalinks Keywords:
Focuses: Cc:
PR Number:

Description

For example, if the site is http://www.mysite.com, requesting http://www.mysite.com/s will redirect to a permalink beginning with 's'. This sends the user to an unexpected page.

This request should redirect to 404 when the page 'http://www.mysite.com/s' doesn't exist.

In the WP installation folder, the following .htaccess rewrite rule causes this problem:
RewriteRule . /index.php [L]

Change History (3)

#1 @SergeyBiryukov
3 years ago

Hi @martinthehorrible, welcome to Trac! Thanks for the report.

This is actually a feature introduced a long time ago, WordPress is trying to guess the correct permalink:
https://developer.wordpress.org/reference/functions/redirect_guess_404_permalink/

If you're looking for a way to disable it, there's a ticket for that: #16557.

#2 @Presskopp
3 years ago

An opportunity to populate a related, disregarded ticket: #36420 (A more forgiving redirect guesser)

#3 @desrosj
8 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Because this is a feature (as noted above by @sergey), I am going to close this one out. #16557 has a much longer history.

Note: See TracTickets for help on using tickets.