동일한 httpd에서 HTTP를 HTTPS로 리디렉션하는 방법은 무엇입니까? 버전 : Apache / 2.2.11 (Unix)) mod_rewrite는 이미

내가 가진 것은 다음과 같습니다.

  • CentOS 5.4 (32 비트)
  • Apache httpd 설치 (서버 버전 : Apache / 2.2.11 (Unix))
  • mod_rewrite는 이미 존재합니다

질문 : VirtualHost 정의를 사용 하지 않고 간단한 http://site.comhttps://site.com 으로 리디렉션하는 방법 은 무엇입니까?

추신 : SF에 대한 나중에 답변을 찾으려고했지만 좋은 해결책을 찾지 못했습니다.

감사.



답변

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


답변

디렉토리를 기반으로 mod_alias 및 Redirect 를 사용할 수 있습니다 . 링크 된 문서는 추가 세부 사항을 식별합니다.

<Directory /path/to/site>
   Redirect /service https://foo2.example.com/service
</Directory>


답변