3

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.
bodruk
  • 177
  • 2
  • 8

1 Answers1

6

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.

Aloha
  • 7,136
  • 1
  • 28
  • 52