https重定向.htaccess

时间:2017-04-19 15:20:32

标签: mod-rewrite apache2

我想将我的域名http://flexy.tk更改为https://flexy.tk,但我不知道在这个.htaccess文件中要编辑什么我是新手,所以请详细说明并且我不会&#39 ; t想要冒任何风险,但我尝试将最后一行从http更改为https,但我不知道它是否正常工作,所以提前感谢

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.flexy\.tk$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteRule ^/?$ "http\:\/\/flexy\.tk\/" [R=301,L]
在降级之前

尝试帮助第一位朋友

1 个答案:

答案 0 :(得分:0)

就这样做:

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]