I am running an apache server for development on windows 7 (via XAMPP).

By default, it is set up to listen on port :80 for http:// requests.

I can configure it for, say, port :1234, and can access web documents via: http://localhost:1234/ just fine.

My question is this - Is is possible to have apache serve on port :1234 but NOT have to include :1234 in the URI for the request?

EDIT/CLARIFICATION: What I am really trying to do is run IIS (on port 80) and apache (xampp) at the same time, without having to add a port number to the browser request for one of them.

2 Answers 2


When you type an URL in a browser, unless you specify the port explicitly, the browser will assume port 80 (unless the path is HTTPS, in which case port 443 is assumed). Technically any URL can be rewritten to include :80 port directive. It is just redundant.

On the server side there can only be one service listening at port 80. So, no, you can not have both IIS and Apache accepting connections without one of the using another port than 80.

The solution...

What is typically done in this situation is for one webserver or the other (usually Apache since this is simple to configure in it) is set up on port 80 and it is responsible for acting as a front end for the other server. I.e. it passes certain requests (based on hostname, path or some other configuration) on to the other server.

I do this extensively where Apache serves as a front-end and directs requests to multiple Tomcat servers.

The Apache configuration you use for this is called "ProxyPass" and, as the name suggests, Apache is simply acting as an intermediary and passing the traffic on to another server for those VirtualHosts or Locations that are specified. For other hosts or paths Apache can still serve its own content directly.

More info here: https://httpd.apache.org/docs/2.2/mod/mod_proxy.html


Sadly it is not possible since this is controlled by the browsers. By default browsers will connect to port 80 and anything else needs to be added in the URL.

There is 3 solutions I can think of what could work but ultimately it will not work for public users since some coding on the clients machines would need to be changed.

Host File Method

You could change the host file and resolve the localhost or domain name with the port. But again this wouldn't for public visitors.

Browser Edit

You could make a plugin to override the default of checking port 80 and add an additional check of port 1234. I'd imagine a plugin for Firefox and chrome like this may exist already or it would be easy to code.


You could run the server on both ports 80 and 1234, you could then direct from 80 to 1234. Again this is because the browser checks for port 80. It doesn't check any other ports especially as high as 1234. I believe the htaccess file would do this for you.


Rather than using XAMP you want to use a real lamp within a virtual environment using virtual-box or vwplayer. By doing so you will receive another ip therefore you can simply run both apache and iis on port 80.


Lamp is so much better than xamp but if you still want to use it then you can run both on port 80 by adding a virtual network card in Windows (called a loop-back) you will need to tell xamp and iis what ips to bind to. For more info go to:http://support.microsoft.com/kb/839013

  • Thanks for having a look at my question. For the host file method - I have looked into this before and found that you can't specify a port (superuser.com/questions/111685/…). Am I misinformed? Also looked into changing default port in browsers, but that would mean changes to all requests not just requests to my dev server. To clarify the question - What I am really trying to do is run IIS (on port 80) and apache (xampp) at the same time, without having to add a port number to the browser request for one of them.
    – GWR
    Jan 21, 2013 at 15:03
  • 1
    ah this is easy then, check my updated answer virtual pc. Jan 21, 2013 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.