Subpages 404 (I know this sounds familiar)

I’ve been moving my portfolio site over to a Digital Ocean server and just when I think I have everything squared away all my subpages start turning up 404s. I’d seen the forum posts about this and have tried just about everything on here.

For reference:
I have mbstring installed
I have multiviews enabled in the Apache conf file
I have c::set(‘ssl’, true); set in the Kirby config file
Also c::set(‘url’, ‘http://example.com’);
I’ve tried having RewriteBase both on and off
Changing the file permissions as described by several posts

Oddly this issue seemed to start up after I installed Let’s Encrypt certs for the site…maybe that can be a helpful clue for someone who knows what’s up? Particularly frustrating since I didn’t have this problem with essentially the same set up with a different site previously.

If anyone has any ideas that would be immensely appreciated!

I take it from the above that the start page works, so it must be a rewriting issue somehow.

If. you are using SSL, your config setting should point to https:

Also c::set('url', 'https://example.com');

Do you have rewrites from http to https in your server config/.htaccess?

Thanks for the reply. Yeah, should have mentioned that the start page does work.

Doesn’t look like I have the rewrites in the .htaccess, though there are rewrites that Let’s Encrypt added to the apache conf file.

What should the .htaccess rewrites look like? These guys?

What does. your apache config file look like now?

Is it Apache or Nginx? What did you pick when you bought the hosting in Digital Ocean?

As for .htaccess question, you should have the one thats in the starterkit zip file up there. Its hidden so unhide files on your machine. From they way your talking, sound like you have a blank .htaccess other then the SSL rules.

I know you mention Apache configs, but some hosting allows you to use Apache files and it translates the file to Nginx.

It’s Apache, I started off with the one click LAMP stack they have.

And the .htaccess is the one from the starterkit, the only change being that I uncommented the “RewriteBase /” line.

Hmm ok… could you please post the entire contents of your .htaccess file? Remember to fence it with ``` and it will come out as readable code :slight_smile:

Here’s what I got right now in the apache config file

<VirtualHost *:80>
        ServerAdmin jake@jakebf.com
        ServerName jakebf.com
        ServerAlias www.jakebf.com

        DocumentRoot /var/www/jakebf.com/public_html

        <Directory /var/www/jakebf.com/public_html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>

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

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

        RewriteEngine on
        RewriteCond %{SERVER_NAME} =evolutionary.co
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

</VirtualHost>

For sure, this is what my .htaccess looks like

# Kirby .htaccess

# rewrite rules
<IfModule mod_rewrite.c>

# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on

# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
# RewriteBase /mysite

# In some enviroments it's necessary to
# set the RewriteBase to:
#
RewriteBase /

# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]

# block all files in the site folder from being accessed directly
# except for requests to plugin assets files
#RewriteRule ^assets/plugins/([a-zA-Z0-9\.\-_%=]+)/(.*)$ site/plugins/$1/assets/$2 [L,N]
#RewriteCond $1 !^plugins/[a-zA-Z0-9\.\-_%=]+/assets/.*
RewriteRule ^site/(.*) index.php [L]

# block direct access to kirby and the panel sources
RewriteRule ^(kirby|panel\/app|panel\/tests)/(.*) index.php [L]

# make panel links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]

# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

</IfModule>

# Additional recommended values
# Remove comments for those you want to use.
#
# AddDefaultCharset UTF-8
#
# php_flag short_open_tag on

Is there also a config file for the SSL port?

I followed this guide for installing the SSL so I didn’t realize there was another conf file in the folder all of a sudden titled “jakebf.com-le-ssl.conf”, now that I’m looking at it for the first time I’m guessing the settings should probably be set to match the other other conf file. Here it is:

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin jake@jakebf.com
        ServerName jakebf.com
        ServerAlias www.jakebf.com

        DocumentRoot /var/www/jakebf.com/public_html

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

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

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/jakebf.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/jakebf.com/privkey.pem
</VirtualHost>
</IfModule>

This looks somehow wrong, because you are using different directories here?

Also, I’d put the stuff from the htaccess into the config file, since you have one, no need to have the server config in two places.

Yeah, that’s just not correct. Seems I just missed configuring that file entirely so just I went back in and set that to match (and match the other config file) and restarted the server and now everything is working beautifully!

Good to know about the htaccess, thanks

Well, great that it works now :slightly_smiling_face:.

If you put the stuff from the .htaccess into the server config, disallow overrides.

Hi, I’m having the same issue with a Digitalocean server.
What steps did fix your installation?
Thank you