<VirtualHost *:82>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/cert.pem
DocumentRoot "/var/www/site"
<Directory "/var/www/site">
allow from all
Options -Indexes
</Directory>
</VirtualHost>
This is my virtual host config. Its working ssl on port 82.
My problem is, when i try to get this page with http its return error page like:
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
Hint: https://localhost:82/
So, i just want to redirect http to https on port 82. I try to add :
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
but its not working since it require http first.
How can i do this?
Thank you.