立即注冊 找回密碼

QQ登錄

只需一步,快速開始

部署https(ssl)后設(shè)置301跳轉(zhuǎn)將http跳轉(zhuǎn)到https-西部數(shù)碼

2018-12-11 12:29| 發(fā)布者: quanshiyinian| 查看: 1016| 評論: 0|原作者: quanshiyinian

摘要: 注意,以下教程針對我司虛擬主機或者亞數(shù)的云主機香港IP部署SSL后的301跳轉(zhuǎn)(非亞數(shù)機房需要注意規(guī)則中行替換),把規(guī)則中域名替換成自己的 linux系統(tǒng) apache環(huán)境云服務(wù)器:【直接在apache上部署的SSL】在對應(yīng)站點根 ...

注意,以下教程針對我司虛擬主機或者亞數(shù)的云主機香港IP部署SSL后的301跳轉(zhuǎn)(非亞數(shù)機房需要注意規(guī)則中行替換),把規(guī)則中域名替換成自己的


linux系統(tǒng) apache環(huán)境

云服務(wù)器:【直接在apache上部署的SSL】在對應(yīng)站點根目錄下新建(通過ftp或登錄wdcp管理面板中:站點列表-文管-進入public_html-創(chuàng)建文件)一個文件命名為.htaccess。

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteCond %{HTTP:From-Https} !^on$ [NC]
  4. #RewriteCond %{HTTPS} !^on$ [NC] # 非亞數(shù)機房用這一行替換上一行規(guī)則
  5. RewriteCond %{HTTP_HOST} ^(www.)?abc.com$ [NC] # 將abc.com和www.abc.com跳轉(zhuǎn)到https://www.abc.com,防止apache子站繼承上級目錄.htaccess受影響
  6. RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L]
  7. </IfModule>
復(fù)制代碼

虛擬主機:可以通過ftp或登錄后進入到主機管理面板-文件管理,進入wwwroot,新建一個文件命名為.htaccess文件,保存即可。

編輯.htaccess文件寫入以下規(guī)則:


  1. <P style="PADDING-BOTTOM: 0px; LINE-HEIGHT: 25px; WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); FONT-STYLE: normal; TEXT-INDENT: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; FONT-FAMILY: 'Microsoft Yahei', 'Hiragino Sans GB', 'Helvetica Neue', Helvetica, tahoma, arial, Verdana, sans-serif, 'WenQuanYi Micro Hei', 宋體; WHITE-SPACE: normal; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(43,43,43); FONT-SIZE: 14px; FONT-WEIGHT: 400; WORD-SPACING: 0px; PADDING-TOP: 0px; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial"> </P>
復(fù)制代碼
  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteCond %{HTTP:From-Https} !^on$ [NC]
  4. RewriteCond %{HTTP_HOST} ^(www.)?abc.com$ [NC] # 將abc.com和www.abc.com跳轉(zhuǎn)到https://www.abc.com,防止apache子站繼承上級目錄.htaccess受影響
  5. RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L]
  6. </IfModule>
復(fù)制代碼

Nginx環(huán)境

編輯nginx站點配置文件(登錄wdcp管理面板中:站點列表-文管-虛擬主機站點文件nginx-對應(yīng)站點配置文件),添加以下規(guī)則

  1. server
  2. {
  3. listen 80;
  4. server_name abc.com;
  5. rewrite ^(.*) https://www.abc.com$1 permanent; # abc.com對應(yīng)修改為您自已的域名
  6. }

  7. 亞數(shù)機房CDN部署的SSL添加下面代碼
  8. if ( $http_from_https != 'on' ){
  9. rewrite ^(.*) https://www.abc.com$1 permanent; # abc.com對應(yīng)修改為您自已的域名
  10. }
復(fù)制代碼

Windows系統(tǒng) IIS7環(huán)境

云服務(wù)器:【直接在IIS上部署的SSL】在對應(yīng)站點根目錄下新建(通過ftp或登錄后直接進入到D:\wwwroot\站點ftp命名目錄\wwwroot創(chuàng)建)一個文件命名為web.config并編輯添加以下規(guī)則:

亞洲數(shù)據(jù)中心機房復(fù)制以下規(guī)則,注意更改為自己的域名

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <system.webServer>
  4. <rewrite>
  5. <rules>
  6. <rule name="301" stopProcessing="true">
  7. <match url="^(.*)$" ignoreCase="false" />
  8. <conditions logicalGrouping="MatchAll">
  9. <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" />
  10. </conditions>
  11. <action type="Redirect" url="https://www.abc.com/{R:1}" redirectType="Permanent" />
  12. </rule>
  13. </rules>
  14. </rewrite>
  15. </system.webServer>
  16. </configuration>
復(fù)制代碼
非亞數(shù)機房復(fù)制以下規(guī)則,注意替換為自己的域名
  1. <SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); FONT-STYLE: normal; TEXT-INDENT: 0px; DISPLAY: inline !important; FONT-FAMILY: 'Microsoft Yahei', 'Hiragino Sans GB', 'Helvetica Neue', Helvetica, tahoma, arial, Verdana, sans-serif, 'WenQuanYi Micro Hei', 宋體; WHITE-SPACE: normal; ORPHANS: 2; FLOAT: none; LETTER-SPACING: normal; COLOR: rgb(43,43,43); FONT-SIZE: 14px; FONT-WEIGHT: 400; WORD-SPACING: 0px; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial"></SPAN>
復(fù)制代碼
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <system.webServer>
  4. <rewrite>
  5. <rules>
  6. <rule name="301" stopProcessing="true">
  7. <match url="^(.*)$" ignoreCase="false" />
  8. <conditions logicalGrouping="MatchAll">
  9. <add input="{HTTPS}" pattern="^on$" negate="true" />
  10. </conditions>
  11. <action type="Redirect" url="https://www.abc.com/{R:1}" redirectType="Permanent" />
  12. </rule>
  13. </rules>
  14. </rewrite>
  15. </system.webServer>
  16. </configuration>
復(fù)制代碼

虛擬主機:可以通過ftp或登錄后進入到主機管理面板-文件管理,進入wwwroot,新建一個文件命名為web.config并編輯添加以下規(guī)則,注意替換為自己的域名。
<?xml version="1.0" encoding="UTF-8"?><configuration> <system.webServer>        <rewrite>            <rules>               <rule name="301" stopProcessing="true">                    <match url="^(.*)$" ignoreCase="false" />                    <conditions logicalGrouping="MatchAll">                        <add input="{HTTP_FROM_HTTPS}" pattern="^on$" negate="true" />                    </conditions>                    <action type="Redirect" url="https://www.abc.com/{R:1}" redirectType="Permanent" />               </rule>            </rules>        </rewrite>    </system.webServer> </configuration>

Windows系統(tǒng) IIS6環(huán)境

參考http://www.west.cn/faq/list.asp?unid=650 配置一個Rewrite,編輯該Rewrite的規(guī)則文件httpd.conf 添加以下規(guī)則。

  1. RewriteEngine On
  2. RewriteCond %{HTTP:From-Https} !^on$ [NC]
  3. #RewriteCond %{HTTPS} !^on$ [NC] # 非亞數(shù)機房用這一行替換上一行規(guī)則
  4. RewriteRule ^(.*)$ https://www.abc.com/$1 [R=301,L] # www.abc.com對應(yīng)修改為您自已的域名
  5. RewriteCond %{HTTP_HOST} !^www\.
  6. RewriteRule ^(.*)$ https://www.abc.com$1 [R=301,L] # www.abc.com對應(yīng)修改為您自已的域名
復(fù)制代碼

tomcat環(huán)境

在web.xml最后一行</web-app>代碼之前添加如下代碼即可


  1. <security-constraint>
  2. <!-- Authorization setting for SSL -->
  3. <web-resource-collection >
  4. <web-resource-name >SSL</web-resource-name>
  5. <url-pattern>/*</url-pattern>
  6. </web-resource-collection>
  7. <user-data-constraint>
  8. <transport-guarantee>CONFIDENTIAL</transport-guarantee>
  9. </user-data-constraint>
  10. </security-constraint>
復(fù)制代碼

注: 1、discuz使用301方式強制將http跳轉(zhuǎn)到https后會導(dǎo)致后臺uc通信失敗。

       2、通過該方式設(shè)置跳轉(zhuǎn)后,如無法正常跳轉(zhuǎn)訪問,請單獨建立站點綁定https域名,仍在原來站點設(shè)置跳轉(zhuǎn)規(guī)則。


請根據(jù)操作系統(tǒng)、站點部署數(shù)量選擇以下相應(yīng)參考文檔,文檔僅供參考,如果對技術(shù)不熟悉,建議提交工單,由我司工程師幫您配置(會有費用產(chǎn)生)。

以上內(nèi)容來源于網(wǎng)絡(luò),僅供參考。










鮮花

握手

雷人

路過

雞蛋

最新評論

相關(guān)推薦
!jz_fbzt! !jz_lxwm! !jz_gfqqq!

關(guān)于我們|手機版|小黑屋|地圖|【道勤網(wǎng)】-bmrsportswear.com 軟件視頻自學(xué)教程|免費教程|自學(xué)電腦|3D教程|平面教程|影視動畫教程|辦公教程|機械設(shè)計教程|網(wǎng)站設(shè)計教程【道勤網(wǎng)】 ( 皖I(lǐng)CP備15000319號-1 )

GMT+8, 2024-10-23 07:37

Powered by DaoQin! X3.4 © 2016-2063 Dao Qin & 道勤科技

返回頂部