简体   繁体   English

htaccess中插件域的Wordpress SSL问题

[英]Wordpress SSL issue for addon domains in htaccess

I have an wp installation on the main domain and a few addon domains which are unrelated. 我在主域和一些无关的插件域上安装了wp。 I installed really simple ssl plugin to handle all un-secure requests made by my site, but all the addon domains are affected and they require also ssl certificate. 我安装了非常简单的ssl插件来处理我的站点发出的所有不安全请求,但是所有插件域都受到影响,并且它们还需要ssl证书。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteRule ^$ https://www.example.com/$1 [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.2.10]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

Without the Really simple ssl it works ok, but this part of the htaccess file affects all subdomains. 如果没有真正简单的ssl,它就可以正常工作,但是htaccess文件的这一部分会影响所有子域。 Also i tried to add 我也尝试添加

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]

in the ssl conditions but now all addon domains are redirected to the main domain. 在ssl条件下,但现在所有插件域都重定向到了主域。

Try this .htaccess: 试试这个.htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /WORDPRESSROOT/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /WORDPRESSROOT/index.php [L]
</IfModule>

# END WordPress

# BEGIN rlrssslReallySimpleSSL rsssl_version[2.2.10]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
# END rlrssslReallySimpleSSL

Change WORDPRESSROOT to the folder where your wordpress is located otherwise delete it and change it to /index.php 将WORDPRESSROOT更改为您的wordpress所在的文件夹,否则将其删除并更改为/index.php

I also use Really Simple SSL but it only affects the folder where the .htaccess is located in. Otherwise try to move your website to /wordpress/ and redirect your site to your root folder. 我也使用Really Simple SSL,但它只会影响.htaccess所在的文件夹。否则,请尝试将您的网站移至/ wordpress /并将网站重定向至根文件夹。

Here's the documentation: 这里是文档:

https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

EDIT: SAVE YOUR OLD .HTACCESS FIRST. 编辑:先保存旧的.HTACCESS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM