SSL Not working with .htaccess code

Hello Blocs Comunity

Im trying to put my SSL in my website but is getting quite impossible. I added too the code that recently had in the forum that is here attached. And after that I have this problem in the website

Used code:

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

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

Once I added appear this:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

After that any page is working. Anyone knows How can I solve that? Cause I’m getting crazy. :confounded:

Thank you! :heart:

Try this:

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

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

I have the same problem and the .htaccess gets hidden.

I did this process, I don’t know from where can come this problem

Is this my website: http://idartist.es and in blocs app I added with all https

With Forklift you can set it to show invisible items. Select the .htacces file and choose to open it with textedit (should be on your Mac) copy Flashman’s code and you should be good to go.

2 Likes

Yes I did it, and appear same error later once I open the website:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Your website opens for me without an error message as http, but if I try accessing the site via https I get this:

Screenshot 2021-01-19 at 20.35.12

Have you enabled an SSL certificate on the server?

When an SSL certificate is added to your server, there is usually an option to have all request automatically direct to the secure version of the site - you shouldn’t have to get involved with editing the .htaccess file at all. I suggest you contact your host and have them set it up for you.

1 Like

First, make sure you have an SSL certificate properly installed on your server. Check your website’s SSL settings are correctly configured.
Then update your code …
Ex…

RewriteEngine On

# Redirect www to non-www (if www is present)
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Now Test it redirects to the non-www version using a 301 (permanent) redirect.
Manually test Use browser developer tools to inspect network requests and redirects or use any online tool like https://redirectchecker.com/ This can help you to get detail redirection chain and its status code.