내 사이트에 SSL 인증서를 설치했는데 "https"가 포함 된 URL을 입력하면 제대로로드되지만 " http://example.org/menu " 와 같이 "http"만 포함 된 URL을 입력 하면 나를 " https://example.org/index.html "로 리디렉션 하고 이유를 모르겠습니다. 이것이 내 htaccess에 포함 된 내용입니다.
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^imgs$ imgs [NC,L,QSA]
RewriteRule ^static$ static [NC,L,QSA]
RewriteRule ^test$ index.html [NC,L,QSA]
RewriteRule ^login$ index.html [NC,L,QSA]
RewriteRule ^menu$ index.html [NC,L,QSA]
RewriteCond %{HTTPS} on!
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
모든 규칙은 SPA이기 때문에 index.html이라고합니다. de SSL을 설치하고 두 개의 최신 줄을 추가하기 전에 문제없이 작동했지만 이제 http로 입력 한 모든 URL이 " https://example.org/index로 리디렉션됩니다. .html "
문제는 URL을 다시 작성한 후에 리디렉션이 발생한다는 것입니다. 재 작성 전에 리디렉션해야합니다. 또한 처음 두 조건은 첫 번째 규칙에만 적용되며 전체적으로 적용되지 않습니다. 당신은 아마 이것의 라인을 따라 뭔가를 원할 것입니다.
Options +FollowSymLinks -MultiViews
RewriteEngine On
# Redirect first, then apply any rewrites after the browser loads the new URL
RewriteCond %{HTTPS} on!
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# If any request is for an existing resource, stop the rewriting immediately
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^imgs$ imgs [NC,L,QSA]
RewriteRule ^static$ static [NC,L,QSA]
RewriteRule ^test$ index.html [NC,L,QSA]
RewriteRule ^login$ index.html [NC,L,QSA]
RewriteRule ^menu$ index.html [NC,L,QSA]
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다