-2

I am wanting to serve a single webpage from my IP for a particular host/domain within Windows. Is this even possible? Any ideas how to achieve this?

Is it possible to have something like this in "hosts" file?

203.223.22.22 microsoft.com
192.168.1.1   microsoft.com/something/index.php

If not, is there another solution to allow me to serve up just that page while normal traffic continues on to the other IP?

2
  • 2
    The host (microsoft.com) will be translated to 192.168.1.1 an then therse is looked for the content under /something/index.php. So you can't solve it using a hostfile. Maybe some http proxys can manage this. Dec 3, 2014 at 11:49
  • 3
    I'm going against the normal grain here and saying that the question shouldn't be closed. The question is very basic for a Windows admin in its original form asking about the hosts file, but sysadmins come in all flavors (I prefer strawberry), and the underlying question about url redirection is really the key question here. I'll edit the question in hopes that the "season of kindness" prevails.
    – TheCleaner
    Dec 3, 2014 at 16:47

1 Answer 1

5

No, it's not possible with the /etc/hosts file. You can only map IP addresses to host names.

One option to achieve that would be to set up a reverse proxy and configure it to answer everything from the remote server except a certain URL.

What is your goal with this?

8
  • but do you know a work-around for this?
    – BlueDotRo
    Dec 3, 2014 at 11:47
  • 1
    Yes, I even outlined it in my answer. And again: What is your end goal? What problem do you try to solve?
    – Sven
    Dec 3, 2014 at 11:50
  • 6
    @BlueDotRo If you're tasked with "testing a hack" and you don't know how host files work, you might want to reassign the job.
    – Reaces
    Dec 3, 2014 at 13:31
  • 1
    @Reaces in my country I have to be multi-functional/multi-tasking and instead of being smart, you should understand that not everybody are on the same wave with you and sometimes they dont use the right words. Anyway, with the help of Boboes I found a bug that my senior developer said to be "It can't be". So . as PM in my country I have to be a developer, architect, QA, etc and yes... I want to quit the job for a better one :) And thanks to all that help me and gave me negative feedback.
    – BlueDotRo
    Dec 3, 2014 at 15:35
  • 1
    @BlueDotRo Would you rather we all pretend half measures are OK, because you're only the person executing them, not the one assigning them? A bad situation is a bad situation regardless of blame. Negative feedback on a negative situation is a good thing...
    – Reaces
    Dec 3, 2014 at 16:32

Not the answer you're looking for? Browse other questions tagged .