WordPress Permalinks 404 bug with “next” button

I fixed the problem by editing my .htaccess file. I replaced it with the following.

# 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