Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

127
Visualizações
Stop localhost auto redirecting to https with the addition of www

Website configured on my localhost 'http://subdomain.customdomain.com' is redirecting to 'https://www.subdomain.customdomain.com' and I cant figure out why.

What I have done is the following:

  1. Setup a hostname on dyn.com ie subdomain.dyndns.org
  2. Setup router to update the dynamic IP to subdomain.dyndns.org on dyn.com (router is updating the IP correctly)
  3. Since I want to use a custom domain added a CNAME record for subdomain.customdomain.com pointing to subdomain.dyndns.org (this is resolving to the correct IP)
  4. Setup port forwarding on the port 80 on my router (external 80 to internal 80)
  5. Setup virtual host on my local apache:

     <VirtualHost subdomain.customdomain.com:80>
        DocumentRoot "C:/xampp/htdocs/customdomain"
        ServerName subdomain.customdomain.com:80
        ServerAlias subdomain.customdomain.com:80
    </VirtualHost>
    

Now when I open http://subdomain.customdomain.com in my browser it redirects to https://www.subdomain.customdomain.com with the error: This site can’t be reached www.subdomain.customdomain.com’s server IP address could not be found.

When I directly add subdomain.customdomain.com to point to my LAN IP in my windows host file, It does not redirect and website works fine. Just cant figure out what is going wrong?

Below are the .htaccess file contents:

# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<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

<FilesMatch "\.(?i:pdf)$">
    ForceType application/pdf
    Header set Content-Disposition attachment
</FilesMatch>

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Fixed the issue! The issue was with the virtual host configurations.

The configuration which was causing the issue

<VirtualHost *:80> 
DocumentRoot "C:/xampp/htdocs/"
ServerName localhost
ServerAlias localhost
<Directory "C:/xampp/htdocs/">
    AllowOverride All
    Require local
</Directory>
</VirtualHost>

<VirtualHost subdomain.customdomain.com:80>
DocumentRoot "C:/xampp/htdocs/some/directory/wordpress"
ServerName subdomain.customdomain.com:80
ServerAlias subdomain.customdomain.com:80
</VirtualHost> 

<VirtualHost www.somedomain.com:80>
DocumentRoot "C:/xampp/some/directory2/wordpress"
ServerName www.somedomain.com:80
ServerAlias somedomain.com:80
</VirtualHost> 

The configuration which fixed it:

<VirtualHost *:80> 
ServerName localhost
ServerAlias localhost
DocumentRoot "C:/xampp/htdocs/"
</VirtualHost>

<VirtualHost *:80>
ServerName subdomain.customdomain.com:80
ServerAlias subdomain.customdomain.com:80
DocumentRoot "C:/xampp/htdocs/some/directory/wordpress"
</VirtualHost> 

<VirtualHost  *:80>
DocumentRoot "C:/xampp/some/directory2/wordpress"
ServerName www.somedomain.com:80
ServerAlias somedomain.com:80
</VirtualHost> 
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda