Wordpress 仅针对管理区域强制\u SSL\u管理
我有一个wordpress网站 我只想将管理区域更改为https。 我尝试添加define('FORCE\u SSL\u ADMIN',true);在wp-config.php中,但它正在更改站点,并且管理区域正在更改为httpsWordpress 仅针对管理区域强制\u SSL\u管理,wordpress,Wordpress,我有一个wordpress网站 我只想将管理区域更改为https。 我尝试添加define('FORCE\u SSL\u ADMIN',true);在wp-config.php中,但它正在更改站点,并且管理区域正在更改为https 有什么想法吗?您可以通过修改.htaccess文件来实现 RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)\ HTTP/ [NC] RewriteCond %{HTTPS} !=on [NC] RewriteRule
有什么想法吗?您可以通过修改.htaccess文件来实现
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)\ HTTP/ [NC]
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^/?(wp-admin/|wp-login\.php) https://example.com%{REQUEST_URI}%{QUERY_STRING} [R=301,QSA,L]
将此代码添加到htaccess文件的顶部
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)\ HTTP/ [NC]
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^/?(wp-admin/|wp-login\.php) https://example.com%{REQUEST_URI}%{QUERY_STRING} [R=301,QSA,L]
希望这对您有用。该常量用于在输入
wp admin
时将连接传输到HTTPS,但在离开wp admin
时不用于将连接传输到普通HTTP。这里的问题是,您将HTTPSwp admin
留在HTTPS前端
您可以使用服务器重写指令或PHPheader
重定向来切换协议。Apache重写的示例(未测试):
<IfModule mod_rewrite.c>
RewriteEngine On
# Are we on HTTPS?
RewriteCond %{HTTPS} on
# Are we _not_ on wp-admin or login?
RewriteCond %{REQUEST_URI} !(/wp-admin|/wp-login)
# Simple redirect to your domain and the requested URL.
RewriteRule ^(.*)$ http://www.yourdomain.abc/$1 [L,R=301]
</IfModule>
好的,这是工作,管理员是得到https,但我现在不能登录,当我点击登录页面刷新不工作。我已经安装了wprdpress https插件,它工作得非常完美,我的客户需要它,没有任何插件,只有这段代码。”定义('FORCE_SSL_ADMIN',true);'正如我所说,这些片段没有经过测试。有没有任何错误或只是什么都没有?没有错误,管理员和网站得到的https,我只想要管理员