---
title: Setup Local Development Domain with Public DNS
date: 2025-11-12T16:19:35+00:00
modified: 2025-11-13T09:53:24+00:00
image:: https://kaspars.net/wp-content/uploads/2025/11/wpenv-net-dns-setup.png
permalink: https://kaspars.net/blog/public-dns-local-development-url
post_type: post
author:
  name: Kaspars
  avatar: https://reverse.kaspars.net/gravatar/avatar/92bfcd3a8c3a21a033a6484d32c25a40b113ec6891f674336081513d5c98ef76?s=96&d=mm&r=g
category:
  - Development
  - WordPress
post_tag:
  - How to
  - Web
---

# Setup Local Development Domain with Public DNS

Did you know that you can point any domain to `127.0.0.1` and it will happily resolve to your local development environment? No more edits to `/etc/hosts` or complex NS server setups.

For example, if the domain of your project is `example.com` then you could set the A record of `local.example.com` to `127.0.0.1`. But wait — there is more — you can have unlimited subdomains such as `*.local.example.com` if your DNS provider supports wildcard A records.

Here is a screenshot of the DNS setup in DigitalOcean that I use for [`*.wpenv.net` domains](https://github.com/kasparsd/wp-env-domains):

![Name server records for local development environment URLs using public DNS](https://kaspars.net/wp-content/uploads/2025/11/wpenv-net-dns-setup.png?strip=all&quality=90&resize=1920,1186)The A record for the root level `wpenv.net` pointing to a GitHub IP for the repository which has the README about the domain. It is like a landing page for the service.

The important bit is the A record for `*.wpenv.net` pointing to `127.0.0.1`.