0

I want to redirect the request to my machine to another URL[not IP address]. Is there any way to achieve this using iptables?.. or what is the way to achieve this?..

3
  • I'm sorry but I don't follow, what are you trying to accomplish? What iptables rule did you create (maybe post the command)?
    – basvdlei
    Jul 27, 2012 at 9:56
  • What are you trying to do, why in god's name would you redirect to another port if you don't have anything running on there? Jul 27, 2012 at 10:39
  • "2.Is there any way to redirect to particular URL rather redirect to IP address or Port?." Sounds like he wants an HTTP redirect. @user1216216 Please explain to us what you're trying to accomplish, not how you are trying to accomplish it, thanks. Jul 27, 2012 at 12:11

1 Answer 1

1

Iptables is used for ipv4 packet filtering. What you want is redirecting an url, which is part of http(rotocol). For forwarding an URL you can use a (simple) webserver, and configure it to forward request to another url.

Depending on your forward requirements this can be a simple html file with

<meta http-equiv="refresh" content="0;URL=http://www.example.com/" />

Or a complicated ruleset using Apache mod_rewrite.

2
  • mod_rewrite complicated? Nah. Well documented, used extensively and once mastered very powerful. Just need to get your head around Regex. Jul 27, 2012 at 21:00
  • Agreed, I meant his requirements for forwarding may be complicated :)
    – basvdlei
    Jul 27, 2012 at 21:17

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