How to disable Letsencrypt redirect all requests to secure HTTPS access

Posted August 16, 2016 40.1k views
UbuntuApacheConfiguration Management

I did the Letsencrypt installation and it works great.
I choose the option to redirect all requests to secure HTTPS access.

I saw those lines added by Letsencrypt in /etc/apache2/sites-available/000-default.conf

        RewriteEngine on
        RewriteCond %{SERVER_NAME}
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

Now I want to disable this feature and to have a part of website without ssl.
So I commented those lines and reloaded Apache but the redirection is still active: still redirect to

How can I fix that?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Yes you are right it was a cache problem because of header time config.

Found the solution here :

Seems like you added the HSTS header to your apache conf. This directive tells the browser visiting your site that for the max age configured in the directive, the browser should access your site always using https. So the “problem” is in your browser right now.

In your apache conf you should have/had something like this:

Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"

3.- Recover all the apache and letsencrypt files that you removed, edit apache conf and change the header directive using max-age=0, something like this:
Header always set Strict-Transport-Security “max-age=0; includeSubdomains; preload”

Reload or restart apache and visit again your site, once visited the browser will ignore the htst header and you could access your site using only http.

I modified this directive using max-age=0 and it worked right away....

Please post your /etc/apache2/sites-available/000-default.conf file and .htaccess file if you have one.

One more thing to note is browsers will cache redirects. You may want to test it using incognito mode.