So Your Local .dev Development Site Stopped Working

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…

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

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.