Good morning, I intend to redirect some sites from port 80 to port 443 On this server I had already configured a virtualhost for port 80 and another for port 443, in the root folder where port 80 has a .htaccess file with the following content:
Redirect 301 / https://xxx.dominio.com/
The fact is that everything is working correctly with that single domain, if you made a request link it is automatically redirected to link But when adding the second domain, I'm seeing that it's as if I ignore that it has a .htaccess to read, however I have a .html that reads correctly.
In this case, if I make a request to link read the html but it does not redirect. On the other hand, confirm that if we make the request link works correctly.
By specifying a bit more, it's an apache2 in a debian 8
I attached the configuration files /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>
Configuration file /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>