I'm trying to create a wifi hotspot with my Raspberry Pi B+ that redirects the connected devices to a specific HTML page, hosted on the Raspberry. I can create the hotspot following this tutorial. Is there a way to force a HTML page load, like some routers do?

The plan is:

  1. The user will connect to the Raspberry Pi wifi hotspot.
  2. The user device will load a HTML page hosted on the Rasp.
  3. The user will download files through the links on the HTML page.

1 Answer 1


You could do that with iptables.

iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination localhost:80
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination localhost:80

This redirects all requests made via port 80 and 443 (i.e. opening any website) to be redirected to whatever is running on your hotspot's port 80.

  • So, I'll just need an Apache server running?
    – bodruk
    Commented Jan 20, 2016 at 12:42
  • How do I disable this redirect?
    – bodruk
    Commented Jan 20, 2016 at 13:16
  • 2
    With command: iptables -L --line-numbers you'll get line numbers for rules and then you can delete single line with iptables -D nat 1 for example. To delete all iptables rules you can use iptables -F
    – Bungee75
    Commented Jan 22, 2016 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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