apache設(shè)置自動(dòng)將http跳轉(zhuǎn)到https的方法
復(fù)制代碼 代碼如下:
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All #這里原先是None要改為All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
加載中~
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All #這里原先是None要改為All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
首先,在網(wǎng)站根目錄下創(chuàng)建.htaccess文件,在最下面添加寫(xiě)入如下語(yǔ)句:
復(fù)制代碼 代碼如下:
RewriteEngine on
RewriteBase / #我這行是沒(méi)有配置
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteEngine on
RewriteBase / #我這行是沒(méi)有配置
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
版權(quán)聲明:
本站所有文章和圖片均來(lái)自用戶(hù)分享和網(wǎng)絡(luò)收集,文章和圖片版權(quán)歸原作者及原出處所有,僅供學(xué)習(xí)與參考,請(qǐng)勿用于商業(yè)用途,如果損害了您的權(quán)利,請(qǐng)聯(lián)系網(wǎng)站客服處理。
本網(wǎng)站LOGO受版權(quán)及商標(biāo)保護(hù),版權(quán)登記號(hào):國(guó)作登字-2022-F-10126915,未經(jīng)湖南木星科技官方許可,嚴(yán)禁使用。
Copyright ? 2012-2022 湖南木星科技有限公司(木星網(wǎng))版權(quán)所有
轉(zhuǎn)載內(nèi)容版權(quán)歸作者及來(lái)源網(wǎng)站所有,本站原創(chuàng)內(nèi)容轉(zhuǎn)載請(qǐng)注明來(lái)源,商業(yè)媒體及紙媒請(qǐng)先聯(lián)系:aishangyiwan@126.com