Ad

Ddev / TYPO3 / .htaccess - Redirect All Http -> Https

- 1 answer

I need help pls understanding ddev/apache and redirects

T3 site config.yaml

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

ddev config.yaml

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

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]

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/

Ad

Answer

Please use such redirect

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