2013-09-11 37 views
0

重定向從HTTP登錄頁面HTTPS我希望我的用戶誰鍵入login.abcde.com被重定向到https://client1.abcde.com並阻止其他所有的HTTP URL。所以如果有人輸入http://client1.abcde.com/thispage/isawesome.html,它會顯示一些錯誤消息或404。到目前爲止,我嘗試將以下內容添加到我的httpd.conf中,但沒有成功。我不斷收到的Apache網頁說法:This page is used to test the proper operation of the Apache HTTP server after it has been installed. If you can read this page, it means that the web server installed at this site is working properly, but has not yet been configured.通過httpd.conf中

RewriteEngine敘述上

的RewriteCond%{} HTTPS關閉

重寫規則^ client1.abcde.com $ https://client1.abcde.com [L,R = 301]

我正在使用Apache的方式,與WSGI。我對80端口的虛擬主機基本上是:

<VirtualHost *:80> 
ServerAdmin [email protected] 
DocumentRoot /srv/www/abcde/html 

ErrorLog "logs/error_log" 
CustomLog "logs/access_log" common 

</VirtualHost> 

回答

0

由於沒有其他人說但我會試試看,這是未經測試,但也許它會給你如何進行的一些想法。也許這可以工作:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^login\.abcde\.com 
RewriteCond %{REQUEST_URI} ^\/$ 
RewriteRule ^/(.+)$ https://client1.abcde.com/$1 [L,R] 

RewriteCond %{HTTP_HOST} ^login\.abcde\.com 
RewriteCond ${HTTPS} !=on 
RewriteRule ^/(.+)$ [F] 

而且它看起來像你的情況,你有^client1.abcde.com$而不是^login.abcde.com$RewriteRule,不知道改變它會使你的解決方案的工作。

也許你可以按RedirectSSL維基頁面中所述在VirtualHost中進行重定向?