PHPackages                             apexmuse/laravel-redirects - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. apexmuse/laravel-redirects

ActiveLibrary[HTTP &amp; Networking](/categories/http)

apexmuse/laravel-redirects
==========================

Nested URLs redirect logic for Laravel

2.1.0(5y ago)01111MITPHPPHP ^7.3

Since Jun 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ApexMuse/laravel-redirects)[ Packagist](https://packagist.org/packages/apexmuse/laravel-redirects)[ RSS](/packages/apexmuse-laravel-redirects/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (5)Versions (4)Used By (0)

Nested redirects for Laravel
============================

[](#nested-redirects-for-laravel)

- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)

Overview
========

[](#overview)

This package allows you to create simple or multiple nested redirects for your Laravel applications.

This package can be useful from an SEO perspective, when in your application, you have URLs that have the potential of being modified.

**Example of the dynamic redirecting logic:**

- Let's assume you have an URL called `/original`
- You create a redirect from `/original` to `/modified`

    > Accessing `/original` will redirect to `/modified`
- You create another redirect from `/modified` to `/modified-again`

    > Accessing `/modified` will redirect to `/modified-again` AND
    > Accessoing `/original` will redirect to `/modified-again`
- You create another redirect from `/modified-again` to `/modified-yet-again`

    > Accessing `/modified-again` will redirect to `/modified-yet-again` AND
    > Accessing `/modified` will redirect to `/modified-yet-again` AND
    > Accessing `/original` will redirect to `/modified-yet-again`
- You create another redirect from `modified-yet-again` to `/original`

    > Accessing `/modified-yet-again` will redirect to `/original` AND
    > Accessing `/modified-again` will redirect to `/original` AND
    > Accessing `/modified` will redirect to `/original`

Installation
============

[](#installation)

Install the package via Composer:

```
composer require apexmuse/laravel-redirects

```

Publish the config file with:

```
php artisan vendor:publish --provider="ApexMuse\Redirects\ServiceProvider" --tag="config"

```

Publish the migration file with:

```
php artisan vendor:publish --provider="ApexMuse\Redirects\ServiceProvider" --tag="migrations"

```

After the migration has been published you can create the `redirects` table by running:

```
php artisan migrate

```

Usage
=====

[](#usage)

### Add the middleware

[](#add-the-middleware)

In order for the redirecting functionality to actually happen, you need to add the `ApexMuse\Redirects\Middleware\RedirectRequests` middleware.

Go to `App\Http\Kernel` and add the `ApexMuse\Redirects\Middleware\RedirectRequests` middleware in your `$middlewareGroups` groups of choice.

```
/**
 * The application's route middleware groups.
 *
 * @var array
 */
protected $middlewareGroups = [
    'web' => [
        ...
        \ApexMuse\Redirects\Middleware\RedirectRequests::class,
```

### Creating redirects

[](#creating-redirects)

You should never use the `ApexMuse\Redirects\Models\Redirect` directly, as this is the default concrete implementation for the `ApexMuse\Redirects\Contracts\RedirectModelContract`.

Using the `ApexMuse\Redirects\Models\Redirect` model class directly will prevent you from being able to extend the model's capabilities.

You can create redirects that will be stored inside the `redirects` table like this:

```
app('redirect.model')->create([
    'old_url' => '/your-old-url',
    'new_url' => '/your-new-url',
    'status' => 301
]);
```

To see how you can extend the `ApexMuse\Redirects\Models\Redirect` model's capabilities, please read the comments from `/config/redirects.php -> redirect_model`

Credits
=======

[](#credits)

- [Andrei Badea](https://github.com/zbiller)
- [All Contributors](../../contributors)

Security
========

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
=======

[](#license)

The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.

Changelog
=========

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
============

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~239 days

Total

3

Last Release

2109d ago

Major Versions

1.0.0 → 2.0.02019-11-19

PHP version history (3 changes)1.0.0PHP ^7.1.3

2.0.0PHP ^7.2

2.1.0PHP ^7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/31fb04ec8762f928bf2ab471a4e4f906819060920a32d95b5d161c479414333c?d=identicon)[ApexMuse](/maintainers/ApexMuse)

---

Top Contributors

[![zbiller](https://avatars.githubusercontent.com/u/2579306?v=4)](https://github.com/zbiller "zbiller (35 commits)")[![ApexMuse](https://avatars.githubusercontent.com/u/13945167?v=4)](https://github.com/ApexMuse "ApexMuse (11 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (2 commits)")[![bacanu](https://avatars.githubusercontent.com/u/1362133?v=4)](https://github.com/bacanu "bacanu (1 commits)")[![pideee](https://avatars.githubusercontent.com/u/23198327?v=4)](https://github.com/pideee "pideee (1 commits)")

---

Tags

urlsluglaravelredirectseo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/apexmuse-laravel-redirects/health.svg)

```
[![Health](https://phpackages.com/badges/apexmuse-laravel-redirects/health.svg)](https://phpackages.com/packages/apexmuse-laravel-redirects)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

21332.6M1.6k](/packages/illuminate-queue)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M165](/packages/spatie-laravel-health)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
