开发者

Modrewrite - virtualhost

I've got mydomain.com

*.conf folder contains a few .conf files for subdomains and some virtual domains such as myotherdomain.com

I want all requests to http mydomain.com to get redirected to https mydomain.com

So I have this:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

That works, but http myotherdomain.com gets redirected to https myotherdomain.com I'd like to keep myotherdomain.com not get redirected to https.

So with some help from stackoverflow yesterday, I changed my file to:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !myotherdomain\.com
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

The existing sites all work just fine. The problem I have now is that http myotherdomain.com doesn't get served properly -- it's as if it is ignoring 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>

Thoughts?


apachectl- S returns:

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

I am sure I am missing something super basic here...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜