apache設(shè)置自動將http跳轉(zhuǎn)到https的方法
更新時間:2013年02月09日 20:23:51 作者:
客戶中心啟用了https的ssl證書,現(xiàn)在需要將原先的http直接跳轉(zhuǎn)到https上。這里為大家提供一個我經(jīng)常使用到的方法,即使用偽靜態(tài)功能
復(fù)制代碼 代碼如下:
<Directory "/opt/fivetrees">
#
# 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
</Directory>
首先,在網(wǎng)站根目錄下創(chuàng)建.htaccess文件,在最下面添加寫入如下語句:
復(fù)制代碼 代碼如下:
RewriteEngine on
RewriteBase / #我這行是沒有配置
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
您可能感興趣的文章:
- apache https配置詳細步驟講解
- Apache mod_rewrite實現(xiàn)HTTP和HTTPS重定向跳轉(zhuǎn)
- 阿里云服務(wù)器apache配置SSL證書成功開啟Https(記錄趟過的各種坑)
- Apache由http自動跳轉(zhuǎn)到https的多種方法
- Apache使用 .htaccess 來實現(xiàn)強制https訪問的方法
- apache中使用mod_gnutls模塊實現(xiàn)多個SSL站點配置(多個HTTPS協(xié)議的虛擬主機)
- 詳解在Ubuntu上的Apache配置SSL(https證書)的正確姿勢
- IIS與APACHE實現(xiàn)HTTP重定向到HTTPS
- Linux環(huán)境下Apache開啟https服務(wù)的方法詳解
相關(guān)文章
CentOS7?minimal?最小化安裝網(wǎng)絡(luò)設(shè)置過程
這篇文章主要介紹了CentOS7?minimal?最小化安裝網(wǎng)絡(luò)設(shè)置過程,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-12-12
Apache James配置連接達夢數(shù)據(jù)庫的步驟
本文介紹了如何配置Apache James郵件服務(wù)器以連接達夢數(shù)據(jù)庫,包括導(dǎo)入JDBC驅(qū)動、修改配置文件和SQL語句,并提供了解決啟動報錯的方法2024-09-09
Apache中解決動態(tài)地址跳轉(zhuǎn)死循環(huán)的方法
這篇文章主要介紹了Apache中解決動態(tài)地址跳轉(zhuǎn)死循環(huán)的方法,另外作者還提出了盡量使用偽靜態(tài)的建議,需要的朋友可以參考下2015-07-07
基于 Ubuntu 的發(fā)行版上安裝微軟 TrueType 字體的教程
這篇文章主要介紹了基于 Ubuntu 的發(fā)行版上安裝微軟 TrueType 字體的教程,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-04-04
centos 7.5 部署varnish緩存服務(wù)器功能
這篇文章主要介紹了centos 7.5 部署varnish緩存服務(wù)器功能,文中給大家介紹了varnish的簡介和主要特征,需要的朋友可以參考下2019-10-10
Centos系統(tǒng)服務(wù)器查看端口是否開放的方法
本文介紹了在Centos系統(tǒng)服務(wù)器上如何查看端口是否開放的方法,通過telnet命令可以輕松實現(xiàn)。這對于服務(wù)器管理員來說非常重要,可以幫助他們及時發(fā)現(xiàn)端口問題并進行修復(fù)。2023-03-03

