Apache Http To Https
- Apache Http To Https Proxy
- Apache Rewrite Http To Https
- Apache Conf Redirect Http To Https
- Apache Https Setup
- Apache Https Rewrite
HTTP to HTTPS
Scenario :
You want to force people coming to your site to use HTTPS. Either for the entire site or a small sub-section of it.
- Note*
Even after restart, my apache server was not listening on 443 (and would only serve on 80), even though everything was correct. I had to enable the SSL module, then everything worked perfectly. In the tutorial, we have to put in terminal “sudo a2ensite ssl”, for mine to work, I also had to run “sudo a2enmod ssl”. Searched for apache redirect http to https and landed here. This is what i did on ubuntu: 1) Enable modules sudo a2enmod rewrite sudo a2enmod ssl 2) Edit your site config.
Using mod_rewrite to do this isn't the recommended behavior. See RedirectSSL
Fix :
Apache Http To Https Proxy
Entire site (.htaccess) :
Apache Rewrite Http To Https
Note: While the rules you need are the same as above (because the rule above doesn't depend on any of the quirks of rewrite in .htaccess), you will need to ensure that you place this in a .htaccess file in the root of the site you want to apply it against, and to make sure you have the appropriate AllowOverride configuration in your httpd.conf
Specific Directory
Apache Conf Redirect Http To Https
Apache Https Setup
Apache Https Rewrite
Either put the above solution in a .htaccess file in the directory to be affected, or put the URI prefix in the regex itself.