Apache: serving SSL only
- by elect
I have a website that I want to be access only by https://myurl.com. A normal typing myurl.com should be forwarded to the https.
I tried different things such as:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://myurl.com/$1 [R,L]
(rewrite mod ON) or
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mysite.example.com
DocumentRoot /usr/local/apache2/htdocs
Redirect permanent /secure https://mysite.example.com/secure
</VirtualHost>
But they didnt work, which is the right way to do it?
Debian & Apache 2