我有mydomain.com
* .conf文件夹包含一些子域名的.conf文件和一些虚拟域名,如myotherdomain.com
我希望http mydomain.com的所有请求都被重定向到https mydomain.com
所以我有这个:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
可行,但http myotherdomain.com被重定向到https myotherdomain.com 我想让myotherdomain.com不被重定向到https。
所以昨天在stackoverflow的帮助下,我将文件更改为:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !myotherdomain\.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
现有的网站都运作得很好。我现在遇到的问题是http myotherdomain.com没有得到正确的服务 - 就好像它忽略了myotherdomain.conf:
<VirtualHost *:80>
DocumentRoot /home/webadmin/myotherdomain.com/html
ServerName myotherdomain.com
ServerAlias "www.myotherdomain.com"
<Directory /home/webadmin/myotherdomain.com/html>
Options Includes FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
思想?
答案 0 :(得分:0)
apachectl- S返回:
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443 is a NameVirtualHost
default server mydomain.com (/etc/httpd/conf/httpd.conf:1100)
port 443 namevhost mydomain.com (/etc/httpd/conf/httpd.conf:1100)
port 443 namevhost mydomain.com (/etc/httpd/conf.d/drupal.conf:3)
port 443 namevhost mydomain.com (/etc/httpd/conf.d/openid.conf:1)
port 443 namevhost mydomain.com (/etc/httpd/conf.d/ssl.conf:88)
*:80 is a NameVirtualHost
default server mydomain.com (/etc/httpd/conf/httpd.conf:1084)
port 80 namevhost mydomain.com (/etc/httpd/conf/httpd.conf:1084)
port 80 namevhost myotherdomain.com (/etc/httpd/conf.d/myotherdomain.conf:1)
Syntax OK
我确信我在这里缺少一些超级基本的东西......