1

I have the following on sites-enabled:
000-default.conf
default-ssl.conf

000-default.conf has:

<VirtualHost *:80>
    ServerName www.optonet.inter.edu
    ServerAdmin webmaster@opto.inter.edu
    DocumentRoot /var/www/html/joomla

    <Directory /var/www/html/joomla>
        Options FollowSymLinks MultiViews 
        Options -Indexes
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

default-ssl.conf has:

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerName www.optonet.inter.edu
        ServerAdmin webmaster@opto.inter.edu
        DocumentRoot /var/www/html/joomla

        SSLEngine on
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
            Options -Indexes
            SSLOptions +StdEnvVars
        </Directory>
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile    **********************
        SSLCertificateKeyFile **********************
    </VirtualHost>
    SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
</IfModule>

When I go to http://www.optonet.inter.edu and any subpage it opens ok. If I try https://www.optonet.inter.edu it opens, but if I try any subpage it shows 404 not found error.

The sites use mod_rewrite and SSL using letsencrypt.

.htaccess has a bunch of redirects, but nothing that refers to http/https

What I am doing wrong?

  • eliminated default-ssl.conf and consolidated everything into 000-default.conf changed under virtualhost:*80 servername -> servername <url>:80 and under virtualhost:*443 -> servername -> servername <url>:443 same result. – ShotgunPR Nov 6 '18 at 13:25
  • to debug I'd run apachectl configtest, for details see httpd.apache.org/docs/2.4/programs/apachectl.html – Fabian Nov 6 '18 at 14:14
3

The problem that you have is because you have not abled AllowOverride All within the SSL virtual host which allows the use of .htaccess which I suspect contains the URL rewrite rules and conditions.

Add this code to your SSL virtual host:

# START NEW CODE
<Directory /var/www/html/joomla>
    Options FollowSymLinks MultiViews 
    Options -Indexes
    AllowOverride All
    Require all granted
</Directory>
# END NEW CODE

Your end code should look something like this:

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
        ServerName www.optonet.inter.edu
        ServerAdmin webmaster@opto.inter.edu
        DocumentRoot /var/www/html/joomla

        SSLEngine on
        <FilesMatch "\.(cgi|shtml|phtml|php)$">
            SSLOptions +StdEnvVars
        </FilesMatch>

        # START NEW CODE
        <Directory /var/www/html/joomla>
            Options FollowSymLinks MultiViews 
            Options -Indexes
            AllowOverride All
            Require all granted
        </Directory>
        # END NEW CODE

        <Directory /usr/lib/cgi-bin>
            Options -Indexes
            SSLOptions +StdEnvVars
        </Directory>
        Include /etc/letsencrypt/options-ssl-apache.conf
        SSLCertificateFile    **********************
        SSLCertificateKeyFile **********************
    </VirtualHost>
    SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
</IfModule>
  • That solved it thanks! I am still a bit of a novice with Apache! – ShotgunPR Nov 6 '18 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.