Buenas, Pretendo redirigir unos sitios de del puerto 80 al puerto 443 En este servidor ya tenía configurado un virtualhost para el puerto 80 y otro para el puerto 443, en la carpeta raíz del que corresponde al puerto 80 tiene un fichero .htaccess con el siguiente contenido:
Redirect 301 / https://xxx.dominio.com/
El caso es que esta funcionando todo correctamente con ese solo dominio, si hacia una petición http://xxx.dominio.com esta se redirigia automáticamente a https://xxx.dominio.com Pero al añadir el segundo dominio, estoy viendo que es como si ignorase que tiene un .htaccess que leer, sin embargo tengo un .html que lee correctamente.
En este caso, si hago un una petición a http://yyy.dominio.com/ lee el html pero no hace la redirección. Por otro lado, confirmaros que si hacemos la petición https://yyy.dominio.com/ funciona correctamente.
Por especificar un poco mas, se trata de un apache2 en un debian 8
Os adjunto los ficheros de configuración /etc/apache2/sites-available/000-default.conf
<VirtualHost *:443>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerName xxx.dominio.com
ServerAdmin [email protected]
DocumentRoot /var/www/xxx
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /var/www/xxx>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log "combined"
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
Fichero de configuracion /etc/apache2/sites-available/yyy.dominio.com
<VirtualHost *:443>
ServerName yyy.dominio.com
ServerAdmin [email protected]
DocumentRoot /var/www/yyy
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride All
</Directory>
<Directory /var/www/yyy>
Options None
#AllowOverride None
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log "combined"
</VirtualHost>
<VirtualHost _default_:80>
DocumentRoot /var/www/html-yyy
ServerName yyy.dominio.com
ServerAdmin [email protected]
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /var/www/html-yyy>
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>