Multiple Webpages on ESP8226


I have used the Ardunio environment with the ESP8226 and everything works fine. But I am trying to create more than one page and can not figure it out. For example

The first or index page would just say "Welcome". Then it would have a button on it that says, "Go to Next Page". When the operator pushes on the button, the second page will come up that may have other buttons in it.

Anyone knows how to do that? Is there any examples? how do you go back and forth between pages?

Thank you for your time.

Best Regards


do you use the ESP8266WebServer library? it has examples

Here is an example that has two pages and links them together. The example uses the aWOT web server library. It is compatible with anything from Arduino Uno to ESP32.

#include <ESP8266WiFi.h>
#include "aWOT.h"

WiFiServer server(80);
Application app;

void index(Request & req, Response & res) {
  res.set("Content-Type", "text/html");
  res.print("<html><body><a href='/page'>Link to page</a></body></html>");

void page(Request & req, Response & res) {
  res.set("Content-Type", "text/html");
  res.print("<html><body><a href='/'>Back to home</a></body></html>");

void setup() {

  WiFi.begin("username", "password");
  while (WiFi.status() != WL_CONNECTED) {

  app.get("/", &index);
  app.get("/page", &page);


void loop() {
  WiFiClient client = server.available();

  if (client.connected()) {

The aWOT routing documentation has more examples.