请提供.htaccess语法来执行以下操作:
我尝试了以下但是没有用:
RewriteCond%{HTTP_HOST} ^ www。(。*)
RewriteRule ^。* $ https://%1/ $ 1 [R = 301,L]
答案 0 :(得分:1)
尝试将以下内容添加到域中根文件夹中的htaccess文件中。
RewriteEngine on
RewriteBase /
#if not domain.com.uk then redirect to domaim.com.uk
RewriteCond %{HTTP_HOST} !^domain\.com\.uk$ [NC]
RewriteRule .* http://domain.com.uk%{REQUEST_URI} [L,R=301]
#if not https
RewriteCond %{HTTPS} off
#redirect to https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
答案 1 :(得分:0)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?domain.com.uk
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://domain.com.uk/$1 [R=301,L]
对我来说这项工作,刚刚测试。所以http://www.domain.com.uk into https://domain.com.uk
.