2013-08-23 26 views
0

我使用Apache 2 Debian的7將特定子域重寫爲基於SSL?

我安裝了一個在線工具,以讓我們說:

tool.myurl.net 

我有一個通配符SSL證書:

*.myurl.net 

我還配置Apache中的virtualhost使用ServerAlias來收聽tool.anotherurl.com

但我沒有該URL的有效SSL證書。

所以我需要一個重寫規則,重定向http://tool.myurl.nethttpS://tool.myurl.net但不是當人們訪問http://tool.anotherurl.com時。

這可能嗎?

+0

澄清你的問題吧。 – anubhava

回答

0

如果我理解正確的話,你要重定向到HTTPS只子域tool.myurl.net所以這個規則應該這樣做:

RewriteEngine On 
# if HTTPS is not being used we force it to HTTPS 
RewriteCond %{HTTPS} !=on 
# because we want to force it for this domain only 
RewriteCond %{HTTP_HOST} ^tool\.myurl\.net$ [NC] 
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 
+0

謝謝你,完美的作品!想知道這是否可能! –

+0

不客氣;) – Prix