Your .htaccess file is not actually being read because it’s in the wrong location
Your .htaccess file is not being processed due to options in your main Apache configuration.
For (1), try see if using this more generic approach helps:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,L]
For (2), confirm that your /var/www/ is indeed your webroot. For example, create a test file to access in your browser:
echo "Hello World" > /var/www/hello-world.txt
For (3), try adding AllowOverride All inside this domain’s <VirtualHost> in your main Apache configuration, and reload Apache. See if it has any effect.
I tried yor code, but no effects. I tried too:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://botboutique.com.br/$1 [R,L]
with no results.
At first I get confused about on where to put .htaccess file. At last, I realize that I must to put it in /var/www/www.botboutique.com.br/html. No effects either.
Changed my apache2.conf:
"<VirtualHost *:80>
ServerName www.botboutique.com.br
Redirect / https://botboutique.com.br
ServerAlias botboutique.com.br *.botboutique.com.br
DocumentRoot /var/www/www.botboutique.com.br/html
<Directory “/var/www/www.botboutique.com.br/html”>
Require all granted
AllowOverride All
"
And … none.
Everytime I used
systemctl restart apache2
to reboot Apache.
The fact that this doesn't do anything points to the possibility that your Apache configuration contains duplicate virtual hosts. If that's the case, that may provide the explanation for why none of your configs seem to do anything.
VirtualHost configuration:
*:443 www.botboutique.com.br (/etc/apache2/sites-enabled/apache2-le-ssl.conf:2)
*:80 is a NameVirtualHost
default server vps18569.publiccloud.com.br (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost vps18569.publiccloud.com.br (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost www.botboutique.com.br (/etc/apache2/sites-enabled/apache2-le-ssl.conf:15)
alias botboutique.com.br
wild alias *.botboutique.com.br
port 80 namevhost www.botboutique.com.br (/etc/apache2/apache2.conf:241)
alias botboutique.com.br
wild alias *.botboutique.com.br
Despite an strange inconsistency among browsers (Chrome and Edge, ok | Firefox says that I have mixed content and shows me an yellow padlock), seems that your tips take me out of my nightmare