For those who aren't familiar with the term "staging", it consists of privately deploying your code to a production server (or a clone of your server) so you can make sure nothing is going to break when you go live.
I usually stage my code on domain staging.example.com where example.com is my production domain.
The problem I frequently run into is when some of the application logic depends on the domain name, especially if the domain name is hard coded somewhere.
How do you deal with that situation, assuming you staging and production environments are on the same server?