Make WordPress Core

Opened 6 years ago

#44804 new defect (bug)

pretty_permalinks capability may not be detected correctly during a fresh install on a server without mod_rewrite

Reported by: ccprog's profile ccprog Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.8
Component: Upgrade/Install Keywords:
Focuses: Cc:


I have a lighttpd server that has a pretty standard setup: no active mod_rewrite rules, but a index-file rule that names index.php as a index file (thus a sort of one-off rewrite). I don't know about other servers, but this may be not that uncommon as a default setup.

Now look at wp_install_maybe_enable_pretty_permalinks() in wp-admin/includes.upgrade.php. If you look closely, the routine to test for active mod_rewrite functionality will ping for get_permalink( $first_post->ID ), if it already exists. During a fresh install, it doesn't, and an empty string is used for testing.

This leads to a false positive, since the empty path is rerouted despite the absence of true rewrite rules. Option permalink_structure is set to /%year%/%monthnum%/%day%/%postname%/, without the leading file name. If you go to the settings page later and change the permalink settings, the error is corrected and the file name inserted - now the $first_post exists.

For almost all practical purposes, this poses no problems, but came to the fore in the most obscure of all places: while testing Gutenberg on a fresh install, the editor crashed - see

Change History (0)

Note: See TracTickets for help on using tickets.