Skip to content

casualmatt/nuxt-easy-redirect

Repository files navigation

nuxt-easy-redirect

npm version npm downloads License Nuxt

Configure simple Redirects within your Nuxt application ➡️

Setup

yarn add nuxt-easy-redirect # yarn
npm i nuxt-easy-redirect # npm
pnpm add nuxt-easy-redirect # pnpm

Basic usage

Add nuxt-easy-redirect to your Nuxt config:

// nuxt.config.ts

export default defineNuxtConfig({
  modules: ["nuxt-easy-redirect"],
});

Configuration

You can configure nuxt-easy-redirect in your nuxt.config.ts file:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: ["nuxt-easy-redirect"],
  redirects: {
    verbose: true,
    rules: [
      {
        origin: "/about",
        destination: "/about-us",
        statusCode: 302,
      },
      {
        origin: "/about1",
        destination: "/about-us2",
        statusCode: 301,
      },
    ],
  },
  devtools: { enabled: true },
});

Development

  1. Clone this repository
  2. Install dependencies using pnpm install or npm install
  3. Run pnpm dev:prepare or npm run dev:prepare
  4. Start development server using pnpm dev or npm run dev

License

Copyright (c) 2023 casualmatt Apache License 2.0