2016-11-19 178 views
2

我在我的網站上安裝了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 請幫我

回答

0
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)和編輯你的問題與他們? –