简体   繁体   中英

TYPO3 Force HTTPS in FE

I have two domains pointing to the same website, domain A and domain B. I want:

  • Domain A to be accessible via HTTP (works fine out of the box)
  • Domain B to redirect all requests to HTTPS. Basically if you type in http://domainb.com/somepage to redirect to http* s *://domainb.com/somepage. I would prefer to have this done via htaccess file.

I tried many solutions and I always get into redirection loop. Eg. I tried this:

RewriteCond     %{SERVER_NAME} ^www\.domainb\.com$ [NC]
RewriteCond %{HTTPS} off
RewriteRule     ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
....
rest of the standard typo3 htaccess commands. 

My code was after typo3 be redirection part and before "Main URL rewriting" part in the htaccess file. With code above I'm redirected to https but then "redirection loop" error is shown.

Any help is highly appreciated.

This works for me :)

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

I include this code right after this line with RewriteEngine On .

尝试这个:

RewriteRule ^http://www\.domainb\.com/(.*) https://www\.domainb\.com/$1 [R=301,L]

The only solution that worked for me was the following one:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM