I want to accept connections on my Raspberry Pi Apache server. I've found that it works great with "http://raspberrypi.local" but when I type in "https://raspberrypi.local" it fails (not available message).

If I wanted to force HTTP (from HTTPS requests) to the file index.php what would I need to change? Could this be done in the .htaccess file? Or do I need to also make sure I'm listening on port 443, as well as 80?


You would have to have something (i.e. Apache) listening on port 443, since every browser will use that port by default for HTTPS. And since you'll have to set a certificate in order to accept connections in the first place, you probably wouldn't gain much by redirecting HTTPS connections to HTTP after all the SSL handshaking (and self-signed certificate warning in the browser) is out of the way.

You can do this kind of redirect via .htaccess, though, and redirecting HTTP to HTTPS is pretty common. I have a general-purpose file-upload form on my site, and this rule forces it to HTTPS. This could be easily adapted to do the reverse.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?upload.php https://%{SERVER_NAME}/upload.php [R,L]

Not the answer you're looking for? Browse other questions tagged or ask your own question.