TYPO3在FE中强制HTTPS

Nem*_* T. 2 .htaccess https http typo3 realurl

我有两个域指向同一个网站,域A和域B.我想:

  • 域A可通过HTTP访问(开箱即用)
  • 域B将所有请求重定向到HTTPS.基本上,如果您输入http://domainb.com/somepage重定向到http*s*://domainb.com/somepage.我希望通过htaccess文件完成此操作.

我尝试了很多解决方案,我总是进入重定向循环.例如.我试过这个:

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. 
Run Code Online (Sandbox Code Playgroud)

我的代码在typo3之后是重定向部分,在htaccess文件中的"主URL重写"部分之前.使用上面的代码,我被重定向到https,但随后显示"重定向循环"错误.

任何帮助都非常感谢.

Bjö*_*örn 6

这对我有用:)

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

我在此行之后包含此代码RewriteEngine On.