1

On my local development machine (Windows 7), I am using IIS and XAMPP to develop websites. Because it is unclear when I have multiple websits running, I am tried to rewrite the hosts file (C:\Windows\System32\drivers\etc). I added this following line of code

127.0.0.1/joomla       joomla

Navigating my browser (I tried it with IE and FF) to 127.0.0.1/joomla works fine, but just typing in "joomla" won't work. I get immediately redirected to Google (i.e. http://www.google.com/search?q=joomla&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a). Also specifying other ports doesn't work (for example: "localhost:8080 someproject" for IIS).

Is there a reason why it won't work? Are there other solutions which also accomplish my "problem" (easier handling with dozen of local running websites, i.e. "more readable URLs")?

3
  • You mention that you are using both IIS and Apache (the A in XAMPP). Are they listening on two different ports, or is only one of the two actually working? XAMPP is designed to be a self-contained Apache/MySQL/PHP stack for development/experimentation purposes and I have never heard of anyone integrating it with IIS. Apr 19, 2012 at 18:13
  • 1
    Yea, there's no integration of the two. They're separate, fully contained web server platforms. I'm wondering if he has a site running on port 80 in both platforms? That would cause one or the other to not function.
    – JohnThePro
    Apr 19, 2012 at 18:53
  • Did this help you, System?
    – JohnThePro
    Apr 20, 2012 at 20:35

2 Answers 2

7

Don't put the slash. You can define multiple host names for 127.0.0.1, but it's done in this format:

127.0.0.1      hostname
127.0.0.1      joomla
127.0.0.1      thatotherwebsite

Once you do the entries in the hosts file, that's all you should need to do. Afterwards, return to your browser, type in the name of the site you want, and good to go.

PS - You'll also need to be running these websites on IIS or Apache that will allow you to define hostname binding per website. Then your web server will deliver the correct site for the name provided. The links provide information for both platforms about how to accomplish this.

2
  • The requirement for hostname binding is not a specific reason to use IIS. Apr 19, 2012 at 14:34
  • I said IIS or something similar. He's running a Windows OS, so there's really no reason to download an extra tool when IIS is built in.
    – JohnThePro
    Apr 19, 2012 at 14:36
3

DNS only maps domain names to IP addresses. It doesn't know anything about file paths.

In your hosts file, you can map the name "joomla" to 127.0.0.1 and then configure Apache to handle requests for "http://joomla/" however you like.

3
  • You do see that he said at the top of his question that he is using IIS right?
    – JohnThePro
    Apr 19, 2012 at 14:37
  • Oh dear, you're right. The question indicates use of both IIS and Apache... but listening on which ports? Hmm. Apr 19, 2012 at 17:04
  • The listening ports would be defined in IIS as well. The modifications to the hosts file would have no bearing on that. (PS - It just dawned on me the A in XAMPP) :)
    – JohnThePro
    Apr 19, 2012 at 17:11

You must log in to answer this question.

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