404 on pretty permalinks when serving via HTTPS

This is a pretty common problem. Unfortunately there are dozens of possible causes, which may be on the server level as well as the WordPress level. Therefore, it is impossible to pinpoint a solution for you.

One thing you know is that the server settings you mention are working correctly at least in part, in the sense that they read the WordPress .htaccess file, because that’s where the redirects for pretty permalinks are stored. Still, there might be trouble if somewhere down the track there is a redirect to http, which the server might then refuse to serve (this seems to be a problem with Google’s service).

Any server related trouble is off topic here, but there are a couple of things on the WordPress level you could try:

  • Disable all plugins (except your SSL-plugin) and resave the permalinks. This makes sure no plugins are redirecting to http
  • Make sure there are no .htaccess files in subdirectories inadvertently redirecting to http.
  • Add $_SERVER['HTTPS']='on'; to your config.php file to tell WordPress that is is supposed to serve all pages with https. Sometimes the server setup is so complex WordPress cannot determine this itself.
  • Alternatively, force your whole domain to https with these lines in .htaccess:

    RewriteEngine On

    RewriteCond %{HTTPS} !=on

    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]