php - htaccess 重定向 301 相对路径,在需要 https 时将 url 从 https 重定向到 http
问题描述
我的 htaccess 中有简单的线条
Redirect 301 /something/ /blog/something/
如果我点击https://www.example.com/something/
它重定向到http://www.example.com/blog/something/
我想要https://www.example.com/something/到https://www.example.com/blog/something/
它应该使用 https 而不是 http
解决方案
尝试这个
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} blog
RewriteRule ^(.*)$ https://www.yourdomain.com/blog/$1 [R,L]
推荐阅读
- sql - 在 Presto 中按最近的时间戳加入
- css - 带框阴影且宽度不等的三角形
- mysql - (mysql(mariadb 10.xx))在哪里匹配全文和按主键排序说'使用文件排序'
- php - 根据旧记录的值从查询中获取新记录
- matlab - 尝试基于现有函数创建符号函数时出现“无法从字面上证明”错误
- php - codeigniter flashdata 成功消息返回失败
- istio - Istio ServiceEntry 用于具有相互 tls 的外部数据库,无法连接到数据库服务
- r - 在 ggplot 中绘制二项式 GLMER 的随机效应
- php - 如何从excel和数据库中计算匹配的id
- grails - Tomcat 中的 Grails Web 部署得到 HTTP 状态 404 – 未找到