2015-05-14 30 views
0

我正在嘗試將ME.com或www.ME dot com重定向到https://NOTME dot com。 下面的代碼工作,但是當我輸入https://ME點com它不會去https://NOTME點com。我得到一個頁面不安全的錯誤。下面 代碼:使用以https開頭的虛擬主機域名進行重定向

<VirtualHost *:80> 
ServerAdmin [email protected] dot com 
ServerName ME dot com 
    ServerAlias www dot ME dot com 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^www dot ME dot com 
RewriteRule ^/(.*)$ http://NOTME dot com/$1 [L,R=301] 
Redirect permanent/https://NOTME dot com/ 
DocumentRoot /var/www/xxx/xxx/ 
<Directory /> 
    Options FollowSymLinks 
    AllowOverride all 
</Directory> 
<Directory /var/www/xxxx/xxxxx/> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride all 
    Order allow,deny 
    allow from all 
</Directory> 

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ 
<Directory "/usr/lib/cgi-bin"> 
    AllowOverride None 
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch 
    Order allow,deny 
    Allow from all 
</Directory> 

ErrorLog ${APACHE_LOG_DIR}/error.log 

# Possible values include: debug, info, notice, warn, error, crit, 
# alert, emerg. 
LogLevel warn 

CustomLog ${APACHE_LOG_DIR}/access.log combined 

Alias /doc/ "/usr/share/doc/" 
<Directory "/usr/share/doc/"> 
    Options Indexes MultiViews FollowSymLinks 
    AllowOverride None 
    Order deny,allow 
    Deny from all 
    Allow from 127.0.0.0/255.0.0.0 ::1/128 
</Directory> 

    <FilesMatch "\.(cgi|shtml|phtml|php)$"> 
      SSLOptions +StdEnvVars 
    </FilesMatch> 
    <Directory /usr/lib/cgi-bin> 
      SSLOptions +StdEnvVars 
    </Directory> 

    BrowserMatch "MSIE [2-6]" \ 
      nokeepalive ssl-unclean-shutdown \ 
      downgrade-1.0 force-response-1.0 
    # MSIE 7 and newer should be able to use keepalive 
    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown   

另外請注意,我設置了ME.com我刪除其被設定爲虛擬主機端口443可我也還是回到了證書給它的HTTPS證書? ME.com和NOTME.com都位於相同的服務器IP上。

回答

0

這是我如何解決了這個問題:

<VirtualHost *:443> 
ServerAdmin [email protected] 
ServerName ME.com 
ServerAlias www.ME.com 
RewriteEngine on 
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 
RewriteCond %{HTTPS} on 
RewriteCond %{HTTP_HOST} ^www.ME.COM/$ 
RewriteRule ^/(.*)$ https://NOTME.COM/$1 [L,R=301] 
Redirect permanent/https://NOTME.COM/ 

SSLEngine on 
SSLCertificateFile /xxxxxxxxxxxx.crt 
SSLCertificateKeyFile /xxxxxxxxxxxx.key 
SSLCertificateChainFile /xxxxxxxxxxxxxx.crt 

其實,解決方案是一個永久重定向到NOTME科網

相關問題