homepage Welcome to WebmasterWorld Guest from 54.226.173.169
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
apache: redirect from one port to another
hugh




msg:4313547
 8:57 am on May 17, 2011 (gmt 0)

I've searched unsuccesfully and really should have a test server in a VM to practice with until then however I need help redirecting requests from one port to another such as example.com:8000 to example.com:8002. All suggestions gratefully received...

Thanks!

Hugh

 

g1smd




msg:4313553
 9:34 am on May 17, 2011 (gmt 0)

Something like:

RewriteCond {HTTP_HOST} ^(www\.)?example\.com:8000$
RewriteRule (.*) http://www.example.com:8002/$1 [R=301,L]


or

RewriteCond {SERVER_PORT} ^8000$
RewriteRule (.*) http://www.example.com:8002/$1 [R=301,L]

hugh




msg:4313560
 10:47 am on May 17, 2011 (gmt 0)

Neither is working unfortunately. Any suggestions?

hugh




msg:4313563
 10:58 am on May 17, 2011 (gmt 0)

iptables was my answer:

iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables-save

Thanks for the feedback g1smd!

g1smd




msg:4313572
 11:32 am on May 17, 2011 (gmt 0)

There was a typo in my code, the { should have been %{ here.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved