So Your Local .dev Development Site Stopped Working

Reading Time: 2 minutes

This afternoon I was trying to work on a local development site using a .dev domain. For whatever reason it was trying to force https://. Well being on a tight deadline I knocked out the changes and pushed it to staging figuring I’d circle back to the odd issue later.

Skip forward a few hours post dinner and putting the 6-month old to bed. I figure I’ll knock out a couple hours of work on a different .dev site. But wait…

.dev domain HTTPS error

Yeah, that’s not good. Two sites redirecting to https suddenly. Something is up.

Then this though hit me, “My Chrome updated today. Oh no. It’s here.”

Yes, if you’re like me you’ve been putting off switching from .dev domains for local development even though Google announced Chrome would force https for the TLD.

My first thought was I’d just add a self-signed SSL certificate through MAMP Pro and just develop on https. I should probably be doing that anyway.

Buuuuut Chrome doesn’t only require SSL on .dev domains. It requires HSTS. Meaning it requires a trusted certificate. And good luck getting a trusted certificate for a local domain1.

So that means it’s time to stop using .dev and switch to one of the protected top level domains. Your options are .invalid, .local, .localhost, .test, .example.

To get your WordPress site setup for the new top level domain you’ll need to update the siteurl and home rows in your wp_options database.

If you’re lucky (or smart) enough to make the changes to your development site before you can’t access your .dev sites you could also update the WordPress Address (URL) and Site Address (URL) in your Settings > General admin screen.

Or you can change the site url via your wp-config.php but this way isn’t recommended. However, if you don’t have access to your database and can’t get to your .dev site you may need to use this method. Drop the following in your wp-config.php and update example to match your desired domain.

define('WP_HOME','http://example.local');
define('WP_SITEURL','http://example.local');

And there you have it. With your updated domains you should be able to get things up and running again in no time.

https://giphy.com/gifs/jurassic-park-jeff-goldblum-dr-malcom-eb8ymYKaJ7JqE

Alternatively you could just use Safari or Firefox. But this will likely expand into other browsers as well so you’d just be delaying the inevitable.

Of course by the time you fix the issue and write a blog post about it your time leftover for development will be severely lacking.

  1. You can’t.

Pin It on Pinterest