Redirect Manager logo

Redirect Manager

By Make.Digital

Manage and configure redirects directly from the Strapi admin panel.

Latest version

v1.0.2

released September 23, 2025

npm install strapi-plugin-redirect-manager

Strapi Plugin: Redirect Manager

šŸ” Centralized redirect management for Strapi v5 – create 301/302 redirects directly from the admin panel

npm version License: MIT


✨ Features

  • 🌐 URL Redirects: Easily manage 301, 302 (and more) HTTP redirects
  • 🧠 Pattern Matching: Supports wildcards like /blog/:slug and RegExp
  • šŸŽ›ļø Intuitive Admin UI: Seamlessly integrated into the admin panel
  • šŸ”„ Auto Middleware: Handles redirects at runtime (optional)
  • āœ… Draft & Publish: Preview redirect entries before going live
  • 🧩 API Accessible: Easily fetch redirects for use in frontend frameworks

šŸŽÆ Compatibility

EnvironmentVersionStatus
Strapiv5.0.0+āœ… Fully Supported
Node.js18.x, 20.x, 22.xāœ… Tested
DatabasePostgreSQL, MySQL, SQLiteāœ… Compatible
FrontendsNext.js, Nuxt, Remix, Astroāœ… Compatible

šŸ“¦ Installation

npm install strapi-plugin-redirect-manager
# or
yarn add strapi-plugin-redirect-manager

šŸ› ļø Setup

  1. Add to plugins configuration (config/plugins.js):

module.exports = {
  'redirect-manager': {
    enabled: true,
  },
};
  1. Restart your Strapi application:

npm run develop

or

yarn develop

šŸ“” API Endpoints

The redirect-manager plugin exposes multiple APIs to manage redirects, settings, and content resolution.

All routes are prefixed with:

/api/redirect-manager

šŸ” 1. Get Single Redirect

Endpoint:

GET /api/redirect-manager/redirect

Description: Fetch a single redirect by query parameters.

Query Params:

from – The source path (e.g. /old-blog)

šŸ“‹ 2. Get All Redirects

Endpoint:

GET /api/redirect-manager/redirect/all

Description: Fetch all registered redirects.

⚔ Next.js Integration Example

You can integrate the Redirect Manager plugin with Next.js to automatically apply server-side redirects.

1. Create a Redirect Fetcher

Inside your Next.js project, add a helper to fetch redirects from Strapi:

// lib/getRedirectHistory.ts
export async function getRedirectHistory(contentType: string, slug: string) {
  try {
    const path = `redirect-manager/redirect`;
    return fetchAPI(
      path,
      { oldSlug: slug, contentType },
      { prefix: "" }
    );
  } catch (error) {
    console.error("Failed to fetch redirect history:", error);
    return { data: null };
  }
}

2. Dynamic Redirect from Content

You can also fetch content-based redirects (from slugs) in getServerSideProps:


// pages/[slug].tsx
import { GetServerSideProps } from "next";

export const getServerSideProps: GetServerSideProps = async ({ params }) => {
  const slug = params?.slug as string;
  const contentType = "api::article.article";

  const redirect = await getRedirectHistory(contentType, slug);

  if (redirect?.data) {
    return {
      redirect: {
        destination: redirect.data.newSlug,
        permanent: redirect.data.redirectType === "301",
      },
    };
  }

  // fallback: fetch content if no redirect
  const res = await fetch(`${process.env.STRAPI_URL}/api/articles/${slug}`);
  if (res.status === 404) {
    return { notFound: true };
  }
  const data = await res.json();
  return {
    props: { article: data },
  };
};

export default function ArticlePage({ article }: any) {
  return <div>{article.title}</div>;
}

Submit your content

Share your work with the community and get it listed in the Strapi ecosystem for everyone to discover and use.

Submit
Submit your content