我有mydomain.com
*.conf文件夹包含一些子域和一些虚拟域(如myotherdomain.com)的.conf文件
我希望所有对http mydomain.com的请求都被重定向到https mydomain.com
所以我有这个:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
这是可行的,但是http myotherdomain.com被重定向到https myotherdomain.com
昨天在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>