For years, developers have used the dev top-level domain as a way to work with local development versions of their projects.
But Google changed all of that last year.
If you’re interested in reading a bit more into this, check out the post by Justin from WebDevStudios does a good job of going into some of the details (as does this post via Daryl Koopersmith – previously working on WordPress, now working at Medium).
But for this post, I’m trying to keep it short and pragmatic. So, the former is this:
If you’re using HTTPS and a dev domain on your local machine, it’s likely going to stop working. Yes, you can add an exception with some browsers, but not all.
If you’ve read this blog for any particular length of time, then you know that I’m a fan of using Valet as part of my local development environment. Part of doing that means that I also secure the local sites to simulate, as much as possible, but staging and production are going to be like.
By default, Valet uses dev as it’s top-level domain, so how do we change that? Luckily, it’s pretty easy.
Changing Valet’s Top-Level Domain
Luckily, changing Valet’s top-level domain is easy. In fact, it’s a matter of entering a simple line in the terminal:
$ valet domain test
And this will change all top-level domains from dev to test so if you have a URL that was once https://trunk.dev it will now be accessible via https://valet.test.
After all of your services restart, you should be able to access the site in your browser of choice using the new top-level domain.
An important note, though: You still may be prompted regarding a security exception. The difference this time, though, is that you can add an exception.
But there’s still one more thing you’ll need to do, and that is to go into the database for your particular application (assuming it’s WordPress) and change the site URL from whatever it once was (which may be https://trunk.dev to https://trunk.test).
And that will take care of changing Valet’s top-level domain and getting you back up and running in your browser of choice.