{"id":205,"date":"2021-01-13T13:39:21","date_gmt":"2021-01-13T05:39:21","guid":{"rendered":"https:\/\/www.ssle.cn\/help\/?p=205"},"modified":"2022-01-13T13:39:38","modified_gmt":"2022-01-13T05:39:38","slug":"apache-qiang-zhi-tiao-zhuan-dao-https","status":"publish","type":"post","link":"https:\/\/ssle.cn\/help\/apache-qiang-zhi-tiao-zhuan-dao-https\/","title":{"rendered":"Apache\u5f3a\u5236\u8df3\u8f6c\u5230 HTTPS"},"content":{"rendered":"<p>\u7f51\u7ad9\u6839\u76ee\u5f55\u65b0\u5efa\u00a0<strong>.htaccess<\/strong><\/p>\n<pre class=\"prettyprint lang-js\"><strong>RewriteEngine On\r\nRewriteCond %{SERVER_PORT} 80\r\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}\/$1 [R,L]<\/strong><\/pre>\n<p>\u7ad9\u70b9\u7ed1\u5b9a\u591a\u4e2a\u57df\u540d\uff0c\u53ea\u5141\u8bb8www.example.com \u8df3\u8f6c<\/p>\n<pre class=\"prettyprint lang-js\">RewriteEngine On\r\nRewriteCond %{SERVER_PORT} 80\r\nRewriteCond %{HTTP_HOST} ^example.com [NC,OR]\r\nRewriteCond %{HTTP_HOST} ^www.example.com [NC]\r\nRewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}\/$1 [R,L]<\/pre>\n<p>###\u628a\u7f51\u5740\u66f4\u6539\u4e3a\u81ea\u5df1\u7684###<\/p>\n<p><strong>\u9ad8\u7ea7\u7528\u6cd5 (\u53ef\u9009\uff09<\/strong><\/p>\n<pre class=\"prettyprint lang-js\">RewriteEngine on\r\n# \u5f3a\u5236HTTPS\r\nRewriteCond %{HTTPS} !=on [OR]\r\nRewriteCond %{SERVER_PORT} 80\r\n# \u67d0\u4e9b\u9875\u9762\u5f3a\u5236\r\nRewriteCond %{REQUEST_URI} ^something_secure [OR]\r\nRewriteCond %{REQUEST_URI} ^something_else_secure\r\nRewriteRule .* https:\/\/%{SERVER_NAME}%{REQUEST_URI} [R=301,L]\r\n# \u5f3a\u5236HTTP\r\nRewriteCond %{HTTPS} =on [OR]\r\nRewriteCond %{SERVER_PORT} 443\r\n# \u67d0\u4e9b\u9875\u9762\u5f3a\u5236\r\nRewriteCond %{REQUEST_URI} ^something_public [OR]\r\nRewriteCond %{REQUEST_URI} ^something_else_public\r\nRewriteRule .* http:\/\/%{SERVER_NAME}%{REQUEST_URI} [R=301,L]<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7f51\u7ad9\u6839\u76ee\u5f55\u65b0\u5efa\u00a0.htaccess RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}\/$1 [R,L] \u7ad9\u70b9\u7ed1\u5b9a\u591a\u4e2a\u57df\u540d\uff0c\u53ea\u5141\u8bb8www.example.com \u8df3\u8f6c RewriteEngine On RewriteC &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-qiang-zhi-https-fang-wen"],"_links":{"self":[{"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/comments?post=205"}],"version-history":[{"count":0,"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/posts\/205\/revisions"}],"wp:attachment":[{"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/media?parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/categories?post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ssle.cn\/help\/wp-json\/wp\/v2\/tags?post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}