从wordpress htaccess重定向到http到https

时间:2018-11-08 03:16:00

标签: wordpress .htaccess http ssl https

这是我的wordpress htaccess文件代码。现在,在激活ssl证书后,我想将http重定向到https。但它不起作用。什么是.well-known / acheme-challenge?该文件夹位于我的根文件夹中。帮帮我

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !
^/\.well-known/pki-validation/[A-F0-9]  {32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !
^/\.well-known/pki-validation/[A-F0-9]  {32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule . /index.php [L]`enter code here`

#END WordPress

1 个答案:

答案 0 :(得分:0)

尝试一下

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

请参阅https://serverguy.com/servers/redirect-http-to-https/