WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#28737 closed defect (bug) (invalid)

404 on custom permalink pagination caused by bad htaccess

Reported by: nhumrich Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.1
Component: Permalinks Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Seams this bug is lurking all over, but all have been marked as invalid, or problem not found.

When using custom permalinks, using the next button (aka page 2, 3, etc.) causes a 404 error.

Switching to default permalink structure fixed the problem.
The error still happens when default theme is used, and all plugins are turned off.

The error is due to the .htaccess file.
The htacess file looks like:

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

# END WordPress

I have changed the htaccess file to the following and it fixed the problem. (AKA, here is the recommended patch)

# BEGIN WordPress
<IfModule mod_rewrite.c>
ErrorDocument 404 /index.php?error=404
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Change History (2)

#1 @SergeyBiryukov
8 years ago

  • Description modified (diff)

#2 @dd32
7 years ago

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

This sounds like a server configuration error outside of .htaccess, as a 404 handler should not be required to be invoked, as the Rewrite rule will match all URL's which do not exist on the filesystem.

It's more likely that the simple act of editing the .htaccess file was enough to trigger a cache clear on the server / to force apache to reload the file.

Note: See TracTickets for help on using tickets.