You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jerry Malcolm <te...@malcolms.com> on 2017/01/23 00:21:17 UTC

[users@httpd] Redirect Applies to All Virtual Hosts

I'm trying to do a simple redirect of http://www.mydomain.com to 
https://mydomain.com. I am using the WAMP package 
wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b.

In the httpd.conf  for the domain in question, I added:

       <VirtualHost *:80>
           ServerName www.mydomain.com
           Redirect permanent / https://mydomain..com
       </VirtualHost>

I host about 10 unrelated domains on this same httpd.  With that block 
above, now every domain I host gets redirected to https://mydomain.com. 
I wouldn't say I'm a blackbelt in virtual host config.  But I've been 
doing it for years.  And from what I understand, the redirect in the 
block above should ONLY apply if the http://www.mydomain.com request is 
received and definitely NOT if an http:XYZ.com request is received.  But 
obviously I'm missing something.  Why does this redirect apply globally 
to all domains? And more importantly, what do I change to get apache to 
only redirect this one url to https://?

Thx.

Re: [users@httpd] Redirect Applies to All Virtual Hosts

Posted by Eric Covener <co...@gmail.com>.
apachectl -S summarizes pretty nicely.

On Sun, Jan 22, 2017 at 7:27 PM, Eric Covener <co...@gmail.com> wrote:
> On Sun, Jan 22, 2017 at 7:21 PM, Jerry Malcolm <te...@malcolms.com> wrote:
>> And from what I understand, the redirect in the block above should ONLY
>> apply if the http://www.mydomain.com request is received and definitely NOT
>> if an http:XYZ.com request is received.  But obviously I'm missing
>> something.  Why does this redirect apply globally to all domains? And more
>> importantly, what do I change to get apache to only redirect this one url to
>> https://?
>
> I assume this virtual host happens to be the first one for *:80, which
> makes it the catch-all default.
>
> You could create a new one before this to act as the catch-all.
>
>
> --
> Eric Covener
> covener@gmail.com



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Redirect Applies to All Virtual Hosts

Posted by Eric Covener <co...@gmail.com>.
On Sun, Jan 22, 2017 at 7:21 PM, Jerry Malcolm <te...@malcolms.com> wrote:
> And from what I understand, the redirect in the block above should ONLY
> apply if the http://www.mydomain.com request is received and definitely NOT
> if an http:XYZ.com request is received.  But obviously I'm missing
> something.  Why does this redirect apply globally to all domains? And more
> importantly, what do I change to get apache to only redirect this one url to
> https://?

I assume this virtual host happens to be the first one for *:80, which
makes it the catch-all default.

You could create a new one before this to act as the catch-all.


-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org