Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!