Welcome to WebmasterWorld Guest from 50.19.0.90

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

apache: redirect from one port to another

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

Junior Member

5+ Year Member

joined:Jan 10, 2007
posts:145
votes: 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
9:34 am on May 17, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 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]
10:47 am on May 17, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 10, 2007
posts:145
votes: 0


Neither is working unfortunately. Any suggestions?
10:58 am on May 17, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 10, 2007
posts:145
votes: 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!
11:32 am on May 17, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


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

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members