Internal Server Error 500 after deploying on ftp

Hi,

I am getting an Internal Server Error 500 when deploying my Kirby folder onto a ftp server.
In the forum I already read similar posts but none of theme solved my problem…
What I already have tried:

  • Added the .htaccess file as it was not in my Kirby/ folder yet. (Next to the folders “assets”, “content” etc., right?)
  • uncommented “RewriteBase /” in the .htaccess file
  • added the directory name in the .htaccess file in which I uploaded the site: RewriteBase /newwebsite/website-2021-01/

Here is my full .htaccess file:

# Kirby .htaccess
# revision 2020-06-15

# 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 /newwebsite/website-2021-01/

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

# block files and folders beginning with a dot, such as .git
# except for the .well-known folder, which is used for Let's Encrypt and security.txt
RewriteRule (^|/)\.(?!well-known\/) index.php [L]

# block all files in the content folder from being accessed directly
RewriteRule ^content/(.*) index.php [L]

# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) index.php [L]

# block direct access to Kirby and the Panel sources
RewriteRule ^kirby/(.*) index.php [L]

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

</IfModule>

# pass the Authorization header to PHP
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

# compress text file responses
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

Did I miss something?

Thanks in advance! :slight_smile:

Adding the folder as RewriteBase is probably wrong, unless you really call the website from that folder. If you point your domain to that folder, the RewriteBase should either be commented or set to /.

Here you are setting the RewriteBase twice, which doesn’t make sense.

  • Make sure that mod_rewrite is enabled on your server (it usually is, but you never know)
  • Make sure that the .htaccess file is not ignored by your server settings.

Okay, makes sense, the Kirby folder is located at this path, so I need this line:

RewriteBase /newwebsite/website-2021-01/

right?

And how can I check if my server has mod_rewrite is enabled and that the .htaccess file is not ignored?

(also uploading the site via gitlab pipeline takes like 5 minutes, I’m not sure if this is normal…?!)

Just tried to set

RewriteBase /newwebsite/website-2021-01/

but it won’t work either…

In most cases, you don’t have to set the RewriteBase at all or have to set it to /, no matter what your folder is called.

And if you already get the error on the home page, then the problem is probably caused by something else. Make sure that all files and folders were correctly uploaded.

1 Like

Is it important that there is also the .htpasswd file at the same location as the .htaccess? It does not exist in my ftp server… Or is it located in a different kirby-folder?

No, such a file is only needed if you want to protect your project with Basic Auth (e.g. during development).

Kirby only uses .htpasswd files for the user accounts in /site/accounts.

1 Like

An internal server error with code 500 is reported in the server logfiles. It would be much easier to find the root cause of your problem if you could reveal what is reported there. I f you do not have access to the logfile, you could ask your provider.

1 Like

The console in chrome only says:

  • Failed to load resource: the server responded with a status of 404 ()
    and
  • Failed to load resource: the server responded with a status of 500 (Internal Server Error)

The console is not the logfile of the server. Every webserver usually writes 2 log files, an access log, where every request is logged and an error log, where errors are logged. A share hosting provider should give access to these files as they are inevitable for problem resolution, especially when the server runs into an error and is not able to deliver anything to the client (hence no detailed information in console log). Usually, these files are made available in the home directory of your account, probably in a subdirectory “logs”. If not, it might be necessary to contact your provider to get access. If thats not possible, I would consider changing the provider.

Additionally, I would suggest to do what @pixelijn already wrote, reset your .htaccess to the original version (from Kirby), because it should work with that.

1 Like