Page 1 of 1

Temporarily redirect URLs to local [Answered]

PostPosted: 09. August 2012 05:36
by timveer
Hello,

First post, but long time reader/user. Thanks to the entire Apache Friends group, volunteers, developers, etc. XAMPP has made my life considerably easier :D Your continued and tireless efforts are fantastic!

My question is how to redirect a URL to a local location on a temporary only basis.

I'm familiar and use etc/hosts, and VirtualHosts a lot, but I need to set up XAMPP on a colleagues computer. He travels a lot and needs to emulate our websites on his laptop, using local copies when the internet is not available, but being able to switch back to the *real* online versions "klick, klack", with (hopefully) just a few mouse clicks. Is this possible?

Thanks again,
Tim
XAMPP 1.77
Control Panel v3.0.2
W7 Pro x64

Re: Temporarily redirect URLs to local

PostPosted: 09. August 2012 12:14
by JonB
Sure -

A simple method might be a batch file that switches out two versions of the hosts file. You will obviously need two permanent copies - say hosts.away & hosts.home or some such thing. Using the 'copy' command rather than 'ren' (rename) probably leaves less room for 'oopsies'. You will probably need to do an attribute change as they are read-only system files, and the batch should be 'run as administrator'.

Good Luck
8)

Re: Temporarily redirect URLs to local

PostPosted: 11. August 2012 01:41
by timveer
Thanks Jon, I'll try this and if all works well post back with my results.
Tim