How can I change from HTTP to HTTPS?

Hi,

My site should be opened with HTTPS
so I found the way from (Force https site)

But I think, I didn’t understand that well.

I did add ‘url’ in my config.php (site/config/config.php)
like this:

return [
    'debug' => true,
    'panel' =>[
    'install' => true
    'url' => 'https://mydomain.com'
  ]
];

but I get error.

How can I change from HTTP to HTTPS?
How do I change .htaccess or config.php for HTTPS?

1 Like

I found the reason.
The problem was caused by a comma.

But it still doesn’t force to https on mobile chrome. What should I do?

What have you put into your .htaccess. And it now works everywhere but in mobile chrome?

Use in .htaccess

www to non www with https

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
2 Likes

Hello I tried Oli1’s set of rewrite rules and conditions in the .htaccess file but at no avail.
I have enabled https in the .conf files of apache but I cannot get any page served past the home page.
the Kirby installation does not seem setup to use cache either… any idea where to start from?

thank you

You have to include the original rewrite rules from the starterkit in your conf files, if you have done that yet.

What sort of cache?

in the virtual host .conf files you mean…?
and where from in the starterkit…?

regarding the cache I I had checked whether the site was caching as you had mentioned here: Set up https instead http - #2 by texnixe

also, as you suggest here: Forced SSL leads to 404 page at "index.php" - #2 by texnixe I tried to set the rewrite in the virtual host conf files.
My options are as follows, in two different files:

<VirtualHost *:80>
ServerName myserver.net
ServerAlias www.myserver.net
Redirect 301 "/" "https://myserver.net/"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

and

<IfModule mod_ssl.c>
<VirtualHost *:443>
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ServerName www.myserver.net
    
    SSLCertificateFile /etc/letsencrypt/live/www.myserver.net/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.myserver.net/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

</VirtualHost>
</IfModule>

Yes

The .htaccess: starterkit/.htaccess at main · getkirby/starterkit · GitHub

To use Kirby’s cache, you would have to explicitely enable it, see docs: cache | Kirby

thanks for the reply, I had edited my previous answer with more info about the configuration but posted the edit just after you lastreplied. apologies…
as far as I can see the .htaccess file is just the original one.

tank you

Just reporting that the issue it solved. My installation was similar to the one discussed in this thread.
Fixing the .conf SSL file fixed the issue.
Thank you