All guides

Set up Selvio on a Next.js site

Add two rewrites to next.config.js so that /compare/ is served by Selvio, then redeploy and check.

Where the rule goes

Open next.config.js at the root of the project (or next.config.mjs, next.config.ts). Paste the rewrites() function inside the exported config object. If the site is a Next.js app hosted on Vercel, use this guide, not the vercel.json one.

The rule

For example.com, with the pages under /compare/. In the dashboard, the same rule is already filled in with your domain and path: copy it from there. If your pages exist in several languages, it has one more block per language (/fr/compare/…).

next.config.js
  // Selvio: the comparison pages of https://example.com/compare/
  // are served by Selvio. Add this to the object exported by next.config.
  async rewrites() {
    return {
      beforeFiles: [
        { source: '/compare', destination: 'https://pages.selvio.io/_h/example.com/compare/' },
        { source: '/compare/:path*', destination: 'https://pages.selvio.io/_h/example.com/compare/:path*' },
      ],
    };
  },

After

Commit, then redeploy the site. Rewrites are read when Next.js builds and starts: a running server does not pick them up.

Check

Open https://example.com/compare/_selvio/proxy-check in a browser, or run this command. The address must answer 200 with this text: selvio-proxy example.com.

Terminal
curl -i https://example.com/compare/_selvio/proxy-check

Then click I deployed it, check in the dashboard: it reads the same address on your domain. The check works before anything is published.

Common pitfalls

The people leaving your competitor will read a page. Make it yours.

Enter your site: Selvio picks up your brand style, suggests your competitors and checks their prices.

Free, no credit card. Nothing goes live without you.