http or https 둘다 접속될 때 css가 안 깨지게 하려면 어떻게 해야되나요?

http or https 둘다 접속될 때 css가 안 깨지게 하려면 어떻게 해야되나요?

QA

http or https 둘다 접속될 때 css가 안 깨지게 하려면 어떻게 해야되나요?

본문

http or https 둘다 접속될 때 css가 안 깨지게 하려면 어떻게 해야되나요?

 

현재는 http로 접속할 때는 css가 안 깨지는데

 

https로 접속하면 css가 깨져서 보안콘텐츠 모두 보기하면 제대로 보이네요

 

모바일에서는 보안 콘텐츠 모두 보기 버튼도 없어서 다 깨져서 나오고요..

 

혹시 어떻게 고쳐야될까요?? http https 둘다 써도 잘 출력되게 할 수는 없을까요?

이 질문에 댓글 쓰기 :

답변 4

css 주소가  /css/style.css  라고 한다면

<link rel="stylesheet" href="http://aaa.com/css/style.css">  ... http(O) , https(X)

<link rel="stylesheet" href="https://aaa.com/css/style.css">  ... http(O) , https(O)

<link rel="stylesheet" href="/css/style.css">  ... http(O) , https(O)  최선의 선택

1. http: 혹은 https:를 떼고 쓰시면 돼요.

<link rel="stylesheet" href="//domain.com/style.css">

 

2. 상대 경로로 지정하셔도 돼요.

<link rel="stylesheet" href="../style.css">

보통은 http 로 접속할 경우 https로 이동시킵니다.

아래는 virtualhost 설정부분입니다.

 


<VirtualHost 11.22.33.44:80>
    DocumentRoot /home/abc/www
    ServerName abc.com
    ServerAlias www.abc.com
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    </IfModule>
</VirtualHost>
<VirtualHost 11.22.33.44:443>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /home/abc/www
    ServerName abc.com
    ServerAlias www.abc.com
    ErrorLog logs/abc.com-error_log
    CustomLog logs/abc.com-access_log common
    SSLEngine on
    SSLCertificateFile "/home/abc/www_abc_com.crt"
    SSLCertificateKeyFile "/home/abc/ssl.key"
    SSLCACertificateFile "/home/abc/www_abc_com.ca-bundle"
</VirtualHost>
답변을 작성하시기 전에 로그인 해주세요.
전체 9
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT