2012-10-10 2 views
3

모든 foo.mydomain.com 요청을 https://foo.mydomain.com으로 리디렉션하려고합니다.http를 사용할 때 Apache가 https 대신 기본 페이지를 표시합니다.

Options FollowSymLinks 
RewriteEngine On 
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://foo.mydomain.com 

사람이 무엇을 알고 있습니까 :이 htaccess로 파일에서 mod_rewrite를 함께 HTTPS로 모든 HTTP 요청을 리디렉션하기 위해 노력하고있어 그래서 지금

<VirtualHost *:443> 
    ServerName foo.mydomain.com 

    # Indexes + root dir 
    DirectoryIndex index.html 
    DocumentRoot /home/web/foo.mydomain.com/htdocs 

    SSLEngine on 

    SSLCertificateFile /etc/apache2/ssl/server.crt 
    SSLCertificateKeyFile /etc/apache2/ssl/server.key 

    SSLVerifyClient none 

    <IfModule mime.c> 
      AddType application/x-x509-ca-cert  .crt 
      AddType application/x-pkcs7-crl   .crl 
    </IfModule> 

    # Logfiles 
    ErrorLog /home/web/foo.mydomain.com/logs/error.log 
    CustomLog /home/web/foo.mydomain.com/logs/access.log combined 
</VirtualHost> 

:

내 VirtualHost 항목이 포함 내가 잘못하고있어? 미리 감사드립니다.

+0

...

가 알려줘 ... '기본 페이지'가 아니라 제목과 덧글을 남길 너무 낮은 담당자에 의미

건배

무엇인지 확실하지가 http을 수행하고 https vhosts는 동일한 문서 루트를 사용합니까? –

답변

0

비 https 사이트에 대해 가상 호스트 구성에서 다음을 시도하십시오.

e.e. 내 설정은 다음과 같습니다.

<VirtualHost *:80> 
RewriteCond %{SEVER_PORT} !^443$ 
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L] 
..... 
</VirtualHost> 

이렇게하면 들어오는 모든 http 요청을 https로 리디렉션해야합니다. 그런 다음 포트 443에 대한 설정에서 필요한 모든 작업을 수행 할 수 있습니다 ....

참고 : htaccess에서도 작동해야합니다.

희망이 있습니다. 당신이 로빈

관련 문제