__Apache 环境中心
尝试设置从http到https的自动重定向
From manage.mydomain.com --- To ---> https://manage.mydomain.com
我尝试将以下内容添加到我的httpd.conf中,但是没有用
RewriteEngine on ReWriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
有任何想法吗?
我实际上已经遵循了这个示例,并且对我有用:)
NameVirtualHost *:80 <VirtualHost *:80> ServerName mysite.example.com Redirect permanent / https://mysite.example.com/ </VirtualHost> <VirtualHost _default_:443> ServerName mysite.example.com DocumentRoot /usr/local/apache2/htdocs SSLEngine On # etc... </VirtualHost>
然后做:
/etc/init.d/httpd restart