我试图强制我的网站从 https 重定向到 http,大多数教程都做相反的事情(强制 http 到 https),到目前为止,我遇到的少数教程对我不起作用。
这就是我的 .htaccess 文件现在的样子
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
最佳答案
使用它来强制使用 HTTP:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
在测试之前请确保清除缓存。
关于.htaccess - 在 .htaccess 中强制使用 HTTP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41873438/