2

For a long time, I didn't use https on my linux server because I didn't find a decent CA that suits my needs. Now, Let's Encrypt (a new CA that provides free certificates) has launched their open beta so I got a certificate from them right away.

I am now redirecting all requests to https and everything works fine so far but since I have used http for ages, I will need some time to rewrite some client software that depends on the wbesite being http. Unfortunately I cannot deploy the update right away since the update mechanism is now broken too :/

So my question is: Is there a way to disable https for one single file in apache2? I'd prefer a solution using a simple .htaccess file but anything else is appreciated as well.

This was added to the VirtualHost *:80 by letsencrypt:

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

1 Answer 1

1

On your default vhost, try the following:

 RewriteEngine on
 RewriteCond %{HTTPS} !=on
 RewriteCond %{REQUEST_URI} !^/path/to/your_single_file.html$
 RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,QSA,R=permanent]
2
  • First of all, sorry for the late reply. Unfortunately I couldn't get on my computer earlier. However, I do have a question about the path. Since it seems to be an absolute path, does it start at the apache document root or the file system root? Thanks in advance.
    – Michael G.
    Dec 22, 2015 at 19:53
  • It is a REQUEST_URI, (that is: the path written by the user in the url bar), so it has to be the apache doument root
    – 473183469
    Dec 23, 2015 at 10:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .