You probably need to try something along these lines assuming that the machine you call
localhost is behind a firewall and web requests are forwarded to
localhost by the firewall.
Set up WordPress as if hosted on the domainname. Therefore if your domainname was
www.example.com and your WordPress install was in
/blog/ you would enter the following values in the WordPress admin user-interface:
This should then means that as long as
www.example.com points at your firewall and your firewall passes traffic for port 80 to
localhost and the webserver on
localhost is setup to be
www.example.com your blog will be accessible from the domain name.
The next step is to make it available for you to work on locally as well. Once setup as detailed above it is likely that access via the domain name won't work when you are on a machine behind the firewall so what you need to do is tell the machine
localhost the IP address for the domain
www.example.com that you would like it to use instead of the one that everyone else uses.
This is achieved by adding an entry to the
/etc/hosts file (on Linux) or the
C:\windows\system32\drivers\etc\hosts file (On Windows XP). If you add the following line to the relevant one of those files on
localhost then you should be able to access the blog by the url http://www.example.com/blog/ while you are on the machine
127.0.0.1 localhost www.example.com
If a line which starts with
127.0.0.1 already exists then add the
www.example.com onto the end on the list of hostnames on that line.
hope this helps.