dsjz1119 2014-11-26 22:41
浏览 240

将所有HTTP重写为HTTPS

I have a website that used to work with HTTP for 12 years. Current database is about 6-7 years old with small modifications, but content is this old and all news entries have images inside it's content (it's news website).

Now I want to go for HTTPS but I have a problem. Images are requested over HTTP because links to images are stored this way in database.

Is there a way to make all these requests switch to https without actually going to database and changing all these links to https?

Current version of website is developed using Laravel 4.

I've already added this to .htaccess.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  • 写回答

1条回答

  • dongxun2089 2014-11-26 22:44
    关注

    You're almost there. A quick search with 'redirect' instead of 'rewrite' returns this: How to redirect all HTTP requests to HTTPS

    In summary:

    RewriteEngine On
    RewriteCond %{HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    评论

报告相同问题?

悬赏问题

  • ¥100 有人会搭建GPT-J-6B框架吗?有偿
  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名