1

Si ingreso a sub.misitio.com ingresa al subdominio correctamente. Pero cuando ingreso a https://sub.misitio.com me redirige a misitio.com Asumo que el problema tiene que estar en .htaccess. Pero no veo ninguna linea que me este redirigiendo. El .htaccess que adjunto es el que esta en la carpeta public del dominio principal. El subdominio no tiene .htaccess Como dato adicional uso let's encrypt, y el dominio y subdominio usan el servicio de godaddy. Y el sitio lo alojo en un server propio de google cloud (debian 9.13, uso virtualmin para crear el subdominio)

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

var\log\virtualmin\sub.midominio.access_log

182.121.114.2 - - [12/Apr/2022:02:17:03 +0000] "POST /GponForm/diag_Form?images/ HTTP/1.1" 404 397 "-" "Hello, World"
::1 - - [12/Apr/2022:02:19:28 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
::1 - - [12/Apr/2022:02:23:13 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
::1 - - [12/Apr/2022:02:25:06 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
66.240.205.34 - - [12/Apr/2022:02:26:46 +0000] "Gh0st\xad" 400 0 "-" "-"
::1 - - [12/Apr/2022:02:29:31 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
192.241.216.106 - - [12/Apr/2022:02:37:08 +0000] "MGLNDD_35.226.9.13_80\n" 400 0 "-" "-"
45.155.204.146 - - [12/Apr/2022:02:43:58 +0000] "POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 404 360 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
::1 - - [12/Apr/2022:02:46:02 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
45.155.204.146 - - [12/Apr/2022:02:48:43 +0000] "GET /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 404 360 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
::1 - - [12/Apr/2022:02:59:57 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
162.142.125.222 - - [12/Apr/2022:03:04:31 +0000] "GET / HTTP/1.1" 200 183 "-" "-"
162.142.125.222 - - [12/Apr/2022:03:04:31 +0000] "GET / HTTP/1.1" 200 209 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)"
162.142.125.222 - - [12/Apr/2022:03:04:31 +0000] "PRI * HTTP/2.0" 400 0 "-" "-"
64.62.197.62 - - [12/Apr/2022:03:05:17 +0000] "GET / HTTP/1.1" 200 183 "-" "-"
::1 - - [12/Apr/2022:03:08:24 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
::1 - - [12/Apr/2022:03:08:54 +0000] "OPTIONS * HTTP/1.0" 200 110 "-" "Apache/2.4.25 (Debian) mod_fcgid/2.3.9 OpenSSL/1.0.2u (internal dummy connection)"
190.107.220.98 - - [12/Apr/2022:03:32:29 +0000] "GET /carpeta/b.html HTTP/1.1" 304 163 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36"
190.107.220.98 - - [12/Apr/2022:03:32:54 +0000] "GET /carpeta/b.html HTTP/1.1" 304 163 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36"
190.107.220.98 - - [12/Apr/2022:03:33:25 +0000] "-" 408 0 "-" "-"
45.155.204.146 - - [12/Apr/2022:03:34:00 +0000] "GET /solr/admin/info/system?wt=json HTTP/1.1" 404 360 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"

var\log\virtualmin\sub.midominio.error_log

[Mon Apr 11 05:59:28.547523 2022] [fcgid:warn] [pid 23502] [client 190.107.220.98:59423] mod_fcgid: stderr: Stack trace:
[Mon Apr 11 05:59:28.547525 2022] [fcgid:warn] [pid 23502] [client 190.107.220.98:59423] mod_fcgid: stderr: #0 {main}
[Mon Apr 11 05:59:28.547528 2022] [fcgid:warn] [pid 23502] [client 190.107.220.98:59423] mod_fcgid: stderr:   thrown in /home/kioscom/domains/a.midominio.com/public_html/index.php on line 24
[Mon Apr 11 05:59:51.391055 2022] [fcgid:warn] [pid 7180] [client 143.198.8.32:50526] mod_fcgid: stderr: PHP Warning:  require(/home/kioscom/domains/a.midominio.com/public_html/../domains/a.midominio.com/a_laravel/vendor/autoload.php): Failed to open stream: No such file or directory in /home/kioscom/domains/a.midominio.com/public_html/index.php on line 24
[Mon Apr 11 05:59:51.391116 2022] [fcgid:warn] [pid 7180] [client 143.198.8.32:50526] mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Failed opening required '/home/kioscom/domains/a.midominio.com/public_html/../domains/a.midominio.com/a_laravel/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/kioscom/domains/a.midominio.com/public_html/index.php:24
[Mon Apr 11 05:59:51.391121 2022] [fcgid:warn] [pid 7180] [client 143.198.8.32:50526] mod_fcgid: stderr: Stack trace:
[Mon Apr 11 05:59:51.391139 2022] [fcgid:warn] [pid 7180] [client 143.198.8.32:50526] mod_fcgid: stderr: #0 {main}
[Mon Apr 11 05:59:51.391142 2022] [fcgid:warn] [pid 7180] [client 143.198.8.32:50526] mod_fcgid: stderr:   thrown in /home/kioscom/domains/a.midominio.com/public_html/index.php on line 24
[Mon Apr 11 05:59:51.457694 2022] [fcgid:warn] [pid 24948] [client 143.198.8.32:50540] mod_fcgid: stderr: PHP Warning:  require(/home/kioscom/domains/a.midominio.com/public_html/../domains/a.midominio.com/a_laravel/vendor/autoload.php): Failed to open stream: No such file or directory in /home/kioscom/domains/a.midominio.com/public_html/index.php on line 24
[Mon Apr 11 05:59:51.457752 2022] [fcgid:warn] [pid 24948] [client 143.198.8.32:50540] mod_fcgid: stderr: PHP Fatal error:  Uncaught Error: Failed opening required '/home/kioscom/domains/a.midominio.com/public_html/../domains/a.midominio.com/a_laravel/vendor/autoload.php' (include_path='.:/usr/share/php') in /home/kioscom/domains/a.midominio.com/public_html/index.php:24
[Mon Apr 11 05:59:51.457756 2022] [fcgid:warn] [pid 24948] [client 143.198.8.32:50540] mod_fcgid: stderr: Stack trace:
[Mon Apr 11 05:59:51.457760 2022] [fcgid:warn] [pid 24948] [client 143.198.8.32:50540] mod_fcgid: stderr: #0 {main}
[Mon Apr 11 05:59:51.457763 2022] [fcgid:warn] [pid 24948] [client 143.198.8.32:50540] mod_fcgid: stderr:   thrown in /home/kioscom/domains/a.midominio.com/public_html/index.php on line 24
[Mon Apr 11 20:37:33.193403 2022] [autoindex:error] [pid 7886] [client 190.107.220.98:64880] AH01276: Cannot serve directory /home/kioscom/domains/a.midominio.com/public_html/carpeta/: No matching DirectoryIndex (index.php,index.php4,index.php5,index.htm,index.html) found, and server-generated directory index forbidden by Options directive

/etc/apache2/sites-enabled/a.kioscom.net-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>
    SuexecUserGroup "#1001" "#1002"
    ServerName a.kioscom.net
    ServerAlias www.a.kioscom.net
    ServerAlias mail.a.kioscom.net
    ServerAlias webmail.a.kioscom.net
    ServerAlias admin.a.kioscom.net
    DocumentRoot /home/kioscom/domains/a.kioscom.net/public_html
    ErrorLog /var/log/virtualmin/a.kioscom.net_error_log
    CustomLog /var/log/virtualmin/a.kioscom.net_access_log combined
    ScriptAlias /cgi-bin/ /home/kioscom/domains/a.kioscom.net/cgi-bin/
    ScriptAlias /awstats/ /home/kioscom/domains/a.kioscom.net/cgi-bin/
    DirectoryIndex index.php index.php4 index.php5 index.htm index.html
    <Directory /home/kioscom/domains/a.kioscom.net/public_html>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted
    AddType application/x-httpd-php .php
    AddHandler fcgid-script .php
    AddHandler fcgid-script .php7.0
    AddHandler fcgid-script .php7.4
    AddHandler fcgid-script .php8.0
    FCGIWrapper /home/kioscom/domains/a.kioscom.net/fcgi-bin/php8.0.fcgi .php
    FCGIWrapper /home/kioscom/domains/a.kioscom.net/fcgi-bin/php7.0.fcgi .php7.0
    FCGIWrapper /home/kioscom/domains/a.kioscom.net/fcgi-bin/php7.4.fcgi .php7.4
    FCGIWrapper /home/kioscom/domains/a.kioscom.net/fcgi-bin/php8.0.fcgi .php8.0
    </Directory>
    <Directory /home/kioscom/domains/a.kioscom.net/cgi-bin>
    allow from all
    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
    Require all granted
    </Directory>
    RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.

#     RewriteCond %{HTTP_HOST} =webmail.a.kioscom.net
#     RewriteRule ^(?!/.well-known)(.*) https://a.kioscom.net:20000/ [R]
#     RewriteCond %{HTTP_HOST} =admin.a.kioscom.net
#     RewriteRule ^(?!/.well-known)(.*) https://a.kioscom.net:10000/ [R]
    RemoveHandler .php
    RemoveHandler .php7.0
    RemoveHandler .php7.4
    RemoveHandler .php8.0
    php_admin_value engine Off
    FcgidMaxRequestLen 1073741824
<Files awstats.pl>
AuthName "a.kioscom.net statistics"
AuthType Basic
AuthUserFile /home/kioscom/domains/a.kioscom.net/.awstats-htpasswd
require valid-user
</Files>
Alias /dav /home/kioscom/domains/a.kioscom.net/public_html
<Location /dav>
    DAV on
    AuthType Basic
    AuthName "a.kioscom.net"
    AuthUserFile /home/kioscom/domains/a.kioscom.net/etc/dav.digest.passwd
    Require valid-user
    ForceType text/plain
    Satisfy All
    RemoveHandler .php
    RemoveHandler .php7.0
    RemoveHandler .php7.4
    RemoveHandler .php8.0
    RewriteEngine off
</Location>

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/kioscom.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/kioscom.net/privkey.pem
</VirtualHost>
</IfModule>
2
  • Más allá de la magia que hace virtualmin, es necesario revisar cómo quedó la configuración del subdominio. Por más cosas que pongas en el htaccess, si la configuración del servidor tiene otras cosas puestas, dificilmente funcione. Es necesario comenzar por los logs de apache (access.log? error.log?) para ver qué hace. De ahí para allá, ver configuraciones asociadas al subdominio. Todo eso, yendo a editar la pregunta y añadiéndolo (y así no tener que adivinar qué pusiste en virtualmin)
    – Alfabravo
    el 11 abr. 2022 a las 20:58
  • Añadi los últimos registros de access.log y error.log del subdominio. En sub.midominio.error_log dice 'index.php on line 24'. Eso es correcto, pero ahora renombre index.php y cree un index.html al cual me deja acceder cuando navego a sub.misitio.com, pero si ingreso sub.misitio.com me redirecciona a misitio.com el 12 abr. 2022 a las 4:05

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.