Enabling SSL on wordpress results in 404

I’m trying to force ssl login and admin but it’s not working.

I’ve tried going through the isecurity theme which didn’t work. I then tried doing it manually by modifying my wp-config.php to include:

define('FORCE_SSL_LOGIN', true);
define('FORCE_SSL_ADMIN', true);

However, when I go to mysite/wp-admin I get:

The requested URL /wp-admin/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Taking those two lines out restores functionality. I’m using the latest version of wordpress and have the default link structure.

Thanks for your help!

1 Answer
1

I had exactly the same problem and the solution for me was to add these lines to /etc/apache2/sites-enabled/default-ssl.conf, which is my SSL-enabled website’s configuration file:

        <Directory /var/www/html/>
                AllowOverride All
        </Directory>

Of course, this assumes DocumentRoot /var/www/html. Change accordingly if is this is different in your setup.

The thing is that WordPress uses .htaccess rules to process the URLs and for them to work, AllowOverride All needs to be in the server’s configuration file.

In my situation, the configuration for the non-SSL and SSL-enabled variants were in a separate files. The non-SSL configuration had AllowOverride All all along, and so everything was working fine. Once I had enabled the SSL, the other configuration file came into play and didn’t have the required AllowOverride All setting.

Leave a Comment