Temporarily redirect URLs to local [Answered]

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Temporarily redirect URLs to local [Answered]

Postby timveer » 09. August 2012 05:36

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
timveer
 
Posts: 2
Joined: 09. August 2012 04:54
Operating System: Win 7 x64

Re: Temporarily redirect URLs to local

Postby JonB » 09. August 2012 12:14

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)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Temporarily redirect URLs to local

Postby timveer » 11. August 2012 01:41

Thanks Jon, I'll try this and if all works well post back with my results.
Tim
timveer
 
Posts: 2
Joined: 09. August 2012 04:54
Operating System: Win 7 x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: Flexnood and 129 guests