 |
 |
Conditional Hosts File
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status:
Offline
|
|
Okay, this isn't exactly a cross post, as I'm asking a slightly different question about a slightly different topic... about the same problem I was having in the network forum.
I'll cut to the chase - I somehow need to have urls resolved differently based on whether I am behind my router or not. For example, if I'm behind my router, then I'd like www.fahrenbacher.com to resolve directly to 192.168.2.2 instead of my router ip, because then it simply resolves to my router's setup utility instead of my website. But if I'm not behind my router, then I want www.fahrenbacher.com to resolve to my router ip, because then my router is smart enough to redirect incomming traffic to the appropriate server. So, is there someway to make my hosts file conditional... or something along those lines?
Thanks.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: May 2004
Status:
Offline
|
|
I've been thinking about the same thing for a little while. The best I can think of is a script that checks your location and renames different hosts files to the active one.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status:
Offline
|
|
|
|
|
-DU-...etc...
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2004
Status:
Offline
|
|
I don't know what an elegant "conditional" solution might be, but I've always punted and have always just added additional lines in my hosts files for internal testing:
192.168.2.2 internal.fahrenbacher.com
Whatever.
Uber
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Midwest
Status:
Offline
|
|
Multihoming? Setup the configs you want in the Network Pref Pane, each with the ip of the DNS server you want to use for that individual configuration. The Location window of the Network Pref Pane is easily accessible via the blue Apple menu if you want to change priorities.
Check out this article from a couple of years ago on Apple's website by David Pogue.
Craig
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status:
Offline
|
|
Perhaps just bookmark it? Say a bookmark for the internal address 192.168.1.whatever, and a separate bookmark for the external. Yer done.
The whole scripting and/or switching of configs seems way more complex than need be.
|
|
-DU-...etc...
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Jan 2004
Status:
Offline
|
|
Originally posted by utidjian:
Perhaps just bookmark it? Say a bookmark for the internal address 192.168.1.whatever, and a separate bookmark for the external. Yer done.
The whole scripting and/or switching of configs seems way more complex than need be.
For me, the problem with just using the internal ip address is I have several virtual hosts set up, so the "name" is important.
Uber
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jan 2001
Location: Mahwah, NJ USA
Status:
Offline
|
|
Originally posted by uberwrensch:
For me, the problem with just using the internal ip address is I have several virtual hosts set up, so the "name" is important.
Easy. Map this "internal" configuration page to a different port, say 5080 (or something). You can do this on the router if it allows it or use a redirect from your webserver. Your bookmark would then look something like http://192.168.2.2:5080 then bookmark it. Yer done.
|
|
-DU-...etc...
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|