By Miguel
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} =evolutionary.co
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: http://mydomain.com still redirect to https://mydomain.com
How can I fix that?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Yes you are right it was a cache problem because of header time config.
Found the solution here : https://community.letsencrypt.org/t/always-redirect-to-https/10838/2
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.
Hey all,
For anyone that stumbles upon this.
The redirect was indeed happening because of the following rules
RewriteEngine on
RewriteCond %{SERVER_NAME} =evolutionary.co
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
Usually, such a rule should be added in the .htaccess file of the website rather than the configuraiton file but both do work.
If you have added the rule in your configuration file, commenting out the lines would require a systemctl restart
of Apache while if you add it to your .htaccess file there wouldn’t be a need for one.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.