Apache: serving SSL only
Posted
by
elect
on Server Fault
See other posts from Server Fault
or by elect
Published on 2012-12-16T18:34:09Z
Indexed on
2012/12/16
23:06 UTC
Read the original article
Hit count: 212
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
© Server Fault or respective owner