npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@syma-lang/strapi-plugin-redirect-manager

v1.0.1

Published

It redirects the content in strapi.

Readme

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

| Environment | Version | Status | |---------------|---------------------|-------------------| | Strapi | v5.0.0+ | ✅ Fully Supported | | Node.js | 18.x, 20.x, 22.x | ✅ Tested | | Database | PostgreSQL, MySQL, SQLite | ✅ Compatible | | Frontends | Next.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>;
}