Wordpress Permalinks 404 under SSL

Posted December 28, 2015 19.9k views

I started a Ubuntu 14.04 droplet with the 1-click preconfigured Wordpress stack. I then set up my SSL certificate following this guide: except I scp'ed my real cert in instead of creating a self-signed. I enabled the default-ssl site and then restarted the service. The homepage at works great. However when you click a link to a permalink, it 404s. However, going to the same link without ssl, at works fine. Mod_rewrite seems to be enabled and working fine as long as it’s not secure. Here are the relevant configs:


<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined


<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        #   SSL Engine Switch:
        #   Enable/Disable SSL for this virtual host.
        SSLEngine on

        #   A self-signed (snakeoil) certificate can be created by installing
        #   the ssl-cert package. See
        #   /usr/share/doc/apache2/README.Debian.gz for more info.
        #   If both key and certificate are stored in the same file, only the
        #   SSLCertificateFile directive is needed.
        SSLCertificateFile  /etc/apache2/ssl/*
        SSLCertificateKeyFile /etc/apache2/ssl/*

        <FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars

        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        # MSIE 7 and newer should be able to use keepalive
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown



# 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]

# END WordPress

Everything looks pretty good. My only guess is maybe changing <FilesMatch> in default-ssl.conf?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
4 answers

I found the answer here:

Duplicating the Directory tag from my default config to my ssl config and restarting fixed the problem.

@emkman Thanks for sharing the solutions, works perfect for me!

Perfect. Thanks, That update fix the problem

Thank you for the update, I could fix the issue too.