You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Wilmer Arambula <te...@gmail.com> on 2017/04/19 23:39:59 UTC

[users@httpd] Best Form Redirect Http --> Https VirtualHost Apache.

<VirtualHost *:80>
    # Valores generales del proyecto
    ServerAdmin administrador@example.com
    ServerName subdomain.example.com

    DocumentRoot /home/domain/public_html/subdomain

    Redirect "/" "https://www.subdomain.example.com"

</VirtualHost>

<VirtualHost *:443>
    # Valores generales del proyecto
    ServerAdmin administrador@example.com
    ServerName subdomain.example.com

    DocumentRoot /home/domain/public_html/subdomain

</VirtualHost>

According to the official documentation of apache the best way to redirect
http to htpps, it is with redirect in a simple way, following this example
in virtualhost I have a problem, for example:

http://subdomain.example.com   --> https://www.subdomain.example.com
--> Assigned
to virtual host works perfect.
http://subdomain1.example.com --> Is not assigned to any virtualhost, Because
it redirects too https://www.subdomain.example.com

Regards,

-- 

*Wilmer Arambula. *

Re: [users@httpd] Best Form Redirect Http --> Https VirtualHost Apache.

Posted by Rainer Canavan <ra...@sevenval.com>.
On Thu, Apr 20, 2017 at 2:05 AM, Wilmer Arambula
<te...@gmail.com> wrote:
>
> If that domain points to your servers external IP, it will be handled by the first *:443 virtualhost:
>
> Ok, Perfect thanks a lot for your answer, is there any way to prevent it from redirecting to the first *: 443 virtualhost, without having to define a virtualhost
> for each domain undefined.

You can define one virtual host that handles all requests that do not match any
of your existing virtual hosts. If you define the new wildcard virtual
host in the
correct order, you won't even have to use a ServerAlias with lots of
"*.* *.*.*" etc.

There's a detailed description of how virtualhost matching works at

https://httpd.apache.org/docs/2.4/vhosts/details.html


rainer

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


Re: [users@httpd] Best Form Redirect Http --> Https VirtualHost Apache.

Posted by Eric Covener <co...@gmail.com>.
On Wed, Apr 19, 2017 at 8:05 PM, Wilmer Arambula <
tecnologiaterabyte@gmail.com> wrote:

> Ok, Perfect thanks a lot for your answer, is there any way to prevent it
> from redirecting to the first *: 443 virtualhost, without having to
> define a virtualhost
> for each domain undefined.


​No, Where would you want it to go?​

Once you create your first *:443 vhost, all traffic on that port goes
there.​ If you create more, you can direct it to the subsequent ones.



-- 
Eric Covener
covener@gmail.com

Re: [users@httpd] Best Form Redirect Http --> Https VirtualHost Apache.

Posted by Wilmer Arambula <te...@gmail.com>.
 If that domain points to your servers external IP, it will be handled by
the first *:443 virtualhost:

Ok, Perfect thanks a lot for your answer, is there any way to prevent it
from redirecting to the first *: 443 virtualhost, without having to define
a virtualhost
for each domain undefined.

Regards,

2017-04-19 19:55 GMT-04:00 Eric Covener <co...@gmail.com>:

> On Wed, Apr 19, 2017 at 7:39 PM, Wilmer Arambula
> <te...@gmail.com> wrote:
> > http://subdomain1.example.com --> Is not assigned to any virtualhost,
> > Because it redirects too https://www.subdomain.example.com
>
> If that domain points to your servers external IP, it will be handled
> by the first *:443 virtualhost.
> If the domain points somewhere else, you don't have an HTTPD question.
>
>
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 
*Wilmer Arambula. *

*Asoc. Cooperativa Tecnologia Terabyte 124, RL.Tlfs: +58 02512623601 - +58
4125110921.*

*Representante para Venezuela.*
*Digital Identification Solutions* *EDI**secure*® *Fingertec*®

Re: [users@httpd] Best Form Redirect Http --> Https VirtualHost Apache.

Posted by Eric Covener <co...@gmail.com>.
On Wed, Apr 19, 2017 at 7:39 PM, Wilmer Arambula
<te...@gmail.com> wrote:
> http://subdomain1.example.com --> Is not assigned to any virtualhost,
> Because it redirects too https://www.subdomain.example.com

If that domain points to your servers external IP, it will be handled
by the first *:443 virtualhost.
If the domain points somewhere else, you don't have an HTTPD question.



-- 
Eric Covener
covener@gmail.com

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