1.确认此服务器apache已经配置过证书可以用https访问到

2.确认/etc/apache2/ports.conf 下有

Listen 80
Listen 443(此条)

3.配置虚礼主机定将域名位到指定文件夹

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel/public
ServerName www.uipxw.com ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> <VirtualHost *:443> ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/laravel/public
ServerName www.uipxw.com ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>

  两条记录相同监听端口不同

4.无框架在需要转为https的入口新建。.htaccess文件

写入

<IfModule mod_rewrite.c>
RewriteEngine On RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule>

5.有框架在需要转为https的入口新建。.htaccess文件

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

  如果不强制转为https框架的(.htaccess文件的内容应该是)

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>

 

apache实现http自动转为https的更多相关文章

  1. Chrome禁止http自动转为https

    解决方法 在Chrome浏览器地址栏输入chrome://net-internals/#hsts 在Delete domain security policies 中输入要删除自动转换的域名 原因 将 ...

  2. golang http自动转为https 如何跳过证书检查

    func SendReq(req *http.Request,result interface{}) error { tr := &http.Transport{ TLSClientConfi ...

  3. Apache 实现ProxyPass转发URL到Tomcat并实现http自动转https【转载】

    转自 Apache 实现ProxyPass转发URL到Tomcat并实现http自动转https - OPEN 开发经验库http://www.open-open.com/lib/view/open1 ...

  4. 今天这篇内容分享Apache由http自动跳转到https的多种方法

    本文主要和大家分享Apache http自动跳转到https的几种方法,非常不错,具有参考借鉴价值,需要的朋友参考下 本文主要和大家分享Apache http自动跳转到https的几种方法,当你的站点 ...

  5. Charles 抓包发现自动跳转为https 问题梳理

    今天遇到个有点意思的问题.特此记录. 业务场景: 做了一个页面,但是对外是挂载在京东主站上.如:www.jd.com/yifu/123456.html. 现场情况: 在本地/测试环境/预发环境中,每次 ...

  6. SpringBoot配置HTTPS,并实现HTTP访问自动转HTTPS访问

    [转]https://www.jianshu.com/p/8d4aba3b972d 推荐使用nginx配置https,因本文产生的任何问题不再做回复. 这里说一下为什么写这篇文章,因为我也是一个Spr ...

  7. apache配置CA证书通过https通信

    Apache Httpd 2.2 实现https加密通讯 实际生产中CA证书一般是向一些专业认证的国际机构来进行申请的.我们会模拟使用OpenSSL生成的证书,来实现Apache的安全加密通讯,这与实 ...

  8. Linux系统将http转为https

    想把网站由http访问转变为https访问并没有想象中那么难,网上查了一些资料,想要转为https需要SSL安全证书,这里推荐一款景安网络的证书,可以免费试用一年时间,自己拿来实践还是很不错的选择. ...

  9. springboot+apache前后端分离部署https

    目录 1. 引言 2. 了解https.证书.openssl及keytool 2.1 https 2.1.1 什么是https 2.1.2 https解决什么问题 2.2 证书 2.2.1 证书内容 ...

随机推荐

  1. Android Studio中debug和release模式默认的参数配置

    The possible properties and their default values are: debuggable:表示是否可以在手机上调试程序. 在Eclipse中,只有android ...

  2. (分享)Linux服务器如何防止中木马

    大家的windows机器可能经常装一些杀毒软件或者什么的来防止中毒,然而在Linux上我们应该怎么防止这些呢? 在面试过程中我们也经常遇到该类问题,那么我们应该怎么回答才显得既有逻辑又有深度呢? 首先 ...

  3. 【BZOJ4199】[Noi2015]品酒大会 后缀数组+并查集

    [BZOJ4199][Noi2015]品酒大会 题面:http://www.lydsy.com/JudgeOnline/wttl/thread.php?tid=2144 题解:听说能用SAM?SA默默 ...

  4. EasyNVR和EasyDSS云平台联手都不能解决的事情,只有国标GB28181能解决了

    需求痛点 我们经常收到这样一种需求,就是将客户手里的各种类型的网络摄像机IPC和网络硬盘录像机NVR进行统一的整合接入和管理,并进行常规的直播.存储.录像检索和回放等操作,而这个时候我们通常会选择用E ...

  5. HUST 1354 - Rubiks (DP)

    1354 - Rubiks 时间限制:1秒 内存限制:64兆 452 次提交 102 次通过 题目描述 Isun is a genius. Not only he is an expert in al ...

  6. FZU 1063 三维扫描(三维连通块)

    Accept: 415    Submit: 1291 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description 工业 ...

  7. c#数据格式转换汇总

    时间差的公式,求出时间相差的转换成刻度值 DateTime endTime = , , , , , , , , , , , , ); TimeSpan temp = new TimeSpan(star ...

  8. POJ 3259 Wormholes【bellman_ford判断负环——基础入门题】

    链接: http://poj.org/problem?id=3259 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#probl ...

  9. DRDS和RDS主要用来存储用户交易信息,MongoDB主要用来存储商品维度信息

    数据集成Data Integration-数加-大数据-阿里云 https://www.aliyun.com/product/cdp 数据集成支持的数据源 数据源类型 数据源 来源数据源被读取 目标数 ...

  10. NoSQL 数据库分类 颠覆

    NoSQL 数据库分类 类型 部分代表特点 列存储 HbaseCassandraHypertable顾名思义,是按列存储数据的.最大的特点是方便存储结构化和半结构化数据,方便做数据压缩,对针对某一列或 ...