1

I've got outdated requests coming into a custom port (2104) on my server.

http://www.server.com:portX

I've now setup my machine to handle those requests at:

http://subdomain.server.com:80

But how can I redirect old requests coming in like that? (through httpd magic)

1 Answer 1

2

In your Apache config, you can make a VirtualHost for the port 2104 with a redirect to the proper URL.

Listen *:2104

<VirtualHost *:2104>
   Redirect 301 / http://subdomain.server.com/
</VirtualHost>

This is assuming your browser can follow redirects. If you need something fancy like a proxy, that's a different story.

8
  • @lunixbochs - I already have a Listen MYIPADDRESS:80 up top - what do i do?
    – siliconpi
    Jun 15, 2011 at 6:05
  • You can listen to more than one port. For example, enabling SSL requires you to add a Listen 443 directive. I dropped this at the very end of a working httpd.conf on a server, restarted apache, and it just worked. You just need to make sure you don't have anything else running on port 2104 on that server anymore (because it'd conflict).
    – lunixbochs
    Jun 15, 2011 at 6:06
  • @lunixbochs - so I just add another line just before the VirtualHost as you specified and it should work fine...?
    – siliconpi
    Jun 15, 2011 at 6:26
  • The exact text I specified should be all you need.
    – lunixbochs
    Jun 15, 2011 at 6:27
  • Hmm @lunixbochs - there are some additional factors. The URL being accessed is like: server.com:2104/sessionadapter.por?id=723491 . This should be redirected to: alpha.server.com:80/sessionadapter.por?id=723491
    – siliconpi
    Jun 15, 2011 at 6:31

You must log in to answer this question.

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