Adding child site without DNS

I have set up a ‘hidden’ development site such as devsite.host.com with no DNS (accessing via local hosts redirect). This set up works fine, but I can’t get my MainWP to connect to it as a child site. I imagine it’s relying on DNS, so is there any other way to accomplish this? Is there a ‘hosts’ file on my MainWP server that I could also edit… or just a way within MainWP to route devsite.host.com to the appropriate server IP?

Hi MikeX3,

Thanks for reaching out.
MainWP doesn’t have a system to route devsite.host.com to appropriate server IP. It needs DNS configured to add the site with Domain name. However, have you tried to connect the site with IP instead of Domain name?

Whether or not you can modify your hosts file on your MainWP server depends on how you host your MainWP instance. If you use shared hosting, you can essentially forget about it. If you control the server, then you can modify the hosts file.

Before you get too deep in the weeds on this mission, I’d encourage you to take a step back and figure out what you are trying to accomplish, why you think they way you approaching the objective it is the most suitable, and most importantly, is there a better way to accomplish that goal.

If you don’t have DNS you probably don’t have TLS (fka SSL), which is bad thing. Assuming that your objective is to hide the development site from prying eyes and unwelcome login attempts, there are better ways to lock the site down which are less disruptive than not using DNS.

You can keep unwanted visitors away with the Coming Soon & Maintenance Mode plugin, and you can secure unauthorized access by limiting the IPs that are allowed to access the login page and the wp-admin path in either your Apache vhost configuration or your .htaccess file. Alternately, many security plugins offer the option to limit administrative access by IP.

Those options are definitely more practical than the no DNS route.

1 Like

I was successfully able to get this going using my server’s host file. I’m also using Cloudflare API so I was able to get ssl without dns. I used coming soon & maintenance mode in the past, along with wordfence, and those sites would still get hammered by bots and bad logon attempts. I suppose restricting the ip is also a good idea but so far the no-dns method is working well.

1 Like

I’m glad you got it working.

As you have demonstrated, there is always more than one way to make something happen. :smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.