Hola,
Mi provedor de hosting me permite crear subdominios y hace poco añadieron el certificado gratuito Let’s Encrypt, pero solo se permite usarlo en el dominio.
EL servidor usa Apache 2.2 y este es el htaccess que tengo actualmente.
Código:
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect subdomains with https to http
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^(www\.)?((.+)dsergio\.(com|dev))$ [NC]
RewriteRule ^/?(.*) http://%2/$1 [NC,R=301,L]
# Redirect domain to https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(dsergio\.(com|dev))$ [NC]
RewriteRule ^/?(.*) https://%2/$1 [NC,R=301,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Hay dos tld porque el .com es el normal y el .dev lo uso en local
Desde el panel de control cree el subdominio static.dsergio.com que apunta a dsergio.com/static pero si pongo el subdominio en el firefox no se redirecciona al http.
Si uso el curl -I
https://static.dsergio.com, tampoco se redirecciona y dice "SSL certificate problem: Invalid certificate chain" si añado --insecure o -k entonces Location pone
http://static.dsergio.com/static que a mi entender tendria que ser
http://static.dsergio.com/
Sabeis donde esta el fallo o es que simplemente no puedo hacerlo y tengo que pasar por el aro y pagar por un certificado que admita subdominios.
Gracias