Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
    
@lunixbochs - I already have a Listen MYIPADDRESS:80 up top - what do i do? –  siliconpi Jun 15 '11 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 '11 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 '11 at 6:26
    
The exact text I specified should be all you need. –  lunixbochs Jun 15 '11 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 '11 at 6:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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