Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 如何强制网站重定向到https_Wordpress_.htaccess - Fatal编程技术网

Wordpress 如何强制网站重定向到https

Wordpress 如何强制网站重定向到https,wordpress,.htaccess,Wordpress,.htaccess,我想将网站重定向到https/.example.com。经由戈达迪。 这是一个wordpress网站,我在谷歌上找到了这个 # BEGIN GD-SSL <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_USER_AGENT} ^(.+)$ RewriteCond %{SERVER_NAME} ^coolexamp

我想将网站重定向到https/.example.com。经由戈达迪。 这是一个wordpress网站,我在谷歌上找到了这个

# BEGIN GD-SSL
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^coolexample\.com$ [OR]
RewriteCond %{SERVER_NAME} ^www\.coolexample\.com$
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security "max-age=300"
</IfModule>
# END GD-SSL
#开始GD-SSL
选项+FollowSymLinks
重新启动发动机
重写cond%{HTTPS}=在…上
重写条件%{HTTP_用户_代理}^(+)$
RewriteCond%{SERVER_NAME}^coolexample\.com$[或]
重写cond%{SERVER_NAME}^www\.coolexample\.com$
重写规则。*https://%{SERVER_NAME}%{REQUEST_URI}[R=301,L]
标题添加严格的传输安全性“最大年龄=300”
#结束GD-SSL

我不知道它是否能工作,也不知道它是否能帮我处理什么是
服务器名,请求URI
,要添加到代码中你可以使用下面的插件,它只需将站点移动到https即可。一旦您购买了ssl

重新启动发动机 重写条件%{HTTPS}关闭 重写规则(.*)https://%{HTTP_HOST}%{REQUEST_URI}[R,L]
我建议您只需阅读文档即可。虽然这段代码可以解决这个问题,但它确实有助于提高文章的质量。请记住,您将在将来回答读者的问题,这些人可能不知道您的代码建议的原因。 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]