Solved - Rewrite HTTP to HTTPS with Let’s Encrypt

Asked

Viewed 109 times

0

I have the . htaccess file with the following content:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?path=$1 [QSA,L]

When loading the page I need to have https already displayed://...

But only when I click on the internal links is the certificate displayed.

I do not understand these instructions very well. I know that the site uses the MVC structure, so this setting in . htaccess

I also have a config.php, which contains some settings and the following line:

define( 'HOME_URI', 'http://meusite.com/' );

From now on I thank you all!

1 answer

-2

add the following lines below the rewriteEngine ON and below your rewriteCond

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

thus leaving the code

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?path=$1 [QSA,L]

this will cause any http request to be redirected to https

  • Thank you Gilmar for the contribution. But the page shows the following error: "Excessive redirection per meusite.com ERR_TOO_MANY_REDIRECTS"

  • Then try instead of those two lines, those two: Rewritecond %{SERVER_PORT} 80 Rewriterule (.*)$ https://seudominio.com.br/$1 [R,L] The editor here does not let enter, plus each Rewrite, is a line

  • My friend, the business has gone punk here. He rewrote the URL with the server path: http://wacabinetsorlando.com/var/www/html/wacabinetsorlando.com/web/wacabinetsorlando.com/

  • I contacted Uol Hosts, and the problem was in their configuration!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.