ddev/TYPO3/.htaccess - 重定向所有 http ->https [英] ddev / TYPO3 / .htaccess - redirect all http -> https

查看:26
本文介绍了ddev/TYPO3/.htaccess - 重定向所有 http ->https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助理解 ddev/apache 和重定向

I need help pls understanding ddev/apache and redirects

T3 站点 config.yaml

T3 site config.yaml

base: 'https://sample-project.ddev.site/'

ddev config.yaml

ddev config.yaml

name: sample-project
webserver_type: apache-fpm
router_http_port: "80"
router_https_port: "443"
use_dns_when_possible: true

在 safari 中调用时效果很好 https://sample-project.ddev.site/但是在 safari sample-project.ddev.site 中调用时它不起作用我得到一个 T3 oops所以我插入了 .htaccess(相当于我的托管服务器)

that works fine when calling in safari https://sample-project.ddev.site/ but when calling in safari sample-project.ddev.site it does not work I get an T3 oops so I have inserted in .htaccess (equivalent to my hosting server)

RewriteCond %{HTTPS} !off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}/$1 [L,R=301]

现在 safari 抱怨太多重定向,我想知道这些重定向来自哪里以及为什么,没有在 T3 后端设置重定向,没有进一步更改 .htaccess 与原始 T3 .htaccess我期待 ddev 简单地将 sample-project.ddev.site 重定向到 https://sample-project.ddev.site/

now safari moans too many redirects and I wonder where these redirects come from and why, no redirects in T3 backend are set, no further changes to .htaccess vs the original T3 .htaccess I was expecting ddev to simply redirect sample-project.ddev.site to https://sample-project.ddev.site/

推荐答案

请使用此类重定向

  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteCond %{HTTPS} off
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

这篇关于ddev/TYPO3/.htaccess - 重定向所有 http ->https的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆