The Core Concept: Rewrites

A rewrite acts as a proxy. When a user visits the source path on your domain, your server fetches the content from the destination URL and serves it to the user. Crucially, the URL in the user’s browser bar does not change.
  • Source: The path on your website that you want to use.
  • Destination: The full URL of your Chatbase help center.
Remember to replace {agentId} with your actual Chatbase Agent ID. You can find this ID in your Chatbase dashboard settings.

Implementation Examples

Choose the tab below that corresponds to your website’s framework or hosting platform.
For projects using the Next.js framework, you can configure rewrites in your next.config.js file. This is the recommended method for Next.js applications.
  1. Open or create the next.config.js file at the root of your project.
  2. Add the rewrites function to the configuration object.
// next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  async rewrites() {
    return [
      {
        source: "/help",
        destination: "https://chatbase.co/{agentId}/help",
      },
      // This second rule is needed to correctly proxy asset requests
      // like CSS, JS, and images from your help center.
      {
        source: "/help/:path*",
        destination: "https://chatbase.co/{agentId}/help/:path*",
      },
    ];
  },
};

module.exports = nextConfig;
After adding this configuration, restart your Next.js development server to apply the changes.
SitemapsYour proxied help center content will not be automatically included in your primary domain’s sitemap. You may need to add these URLs manually if SEO for your help content is a priority.