从SSL中排除子域

问题描述:

我在我的网站上安装了SSL,但我想要我的SSL证书只在我的主域(不是子域)上工作。 我在我的主域名安装WordPress的,我在我的子域安装YetiForce从SSL中排除子域

我用下面的.htaccess文件代码

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://vinyl.co.id/$1 [R,L] 
# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_HOST} stock.vinyl.co.id 
RewriteCond %{REQUEST_URI} !stock/ 
RewriteRule ^(.*)$ stock/$1 [L] 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 

但我仍然无法访问http://stock.vinyl.co.id 请帮我

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://vinyl.co.id/$1 [R,L] 

将(在任何域名)上的任何人重定向到https://vinyl.co.id/。添加其他RewriteCond只将其应用到vinyl.co.id

RewriteCond %{HTTP_HOST} vinyl.co.id 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://vinyl.co.id/$1 [R,L] 

注意,这会让你的HTTP访问stock.vinyl.co.id,不禁止 HTTPS(我没有你所说的“排除从一个子域的意思SSL“)。

+0

你好@大卫, 我已经编辑这样 .htaccess文件RewriteEngine叙述'在 的RewriteCond%{HTTP_HOST} vinyl.co.id 的RewriteCond%{SERVER_PORT} 80 重写规则^(。*)$ https://vinyl.co.id/$1 [R,L] #BEGIN WordPress的 RewriteEngine叙述在 RewriteBase/ 的RewriteCond%{HTTP_HOST} stock.vinyl.co.id 的RewriteCond%{ REQUEST_URI}!stock/ RewriteRule ^(。*)$ stock/$ 1 [L] RewriteRule^index \ .php $ - [L] RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule。的index.php [L] #END WordPress' 我仍然得到服务器没有找到 – incubusholic

+0

你能启用重写模块([RewriteLog和RewriteLogLevel](调试日志https://httpd.apache.org /docs/2.2/mod/mod_rewrite.html#rewritelog)为apache 2.2, [LogLevel](https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#logging)为apache 2.4)和编辑你的问题与他们? –