Assuming you are using Apache, you should instead use name-based virtual hosts http://httpd.apache.org/docs/2.2/vhosts/
That way you can have
http://demo.localhost http://production.localhost
and the paths will be preserved.
Carl Wiedemann Website design and development consulting carl.wiedemann@gmail.com | skype: c4rlww