April 12th, 2009
So here’s a useful trick I was reminded of this past week.
Sometimes as a developer I write code that appears on multiple web sites. I just write a few lines that check what domain name the current site is using and execute the relevant code appropriately. Confusing? Think about when you sign up for an account at WordPress.com. You have a blog at yourusername.wordpress.com. Everyone’s different blogs are all pointing to the same code, but different database records are pulled based on the domain name being used.
The inconvenience here as a developer is when you need to test what you’ve written with a particular domain. You can update the DNS to point to your server, but if there’s a problem then the whole world is going to be looking at the broken site. You need to see it, though, so you can fix it.