PHPackages                             lidai/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. lidai/laravel-redirects

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

lidai/laravel-redirects
=======================

Nested URLs redirect logic for Laravel

v1.0.4(4y ago)0444MITPHPPHP ^7.4|^8.0

Since Jun 4Pushed 4y ago2 watchersCompare

[ Source](https://github.com/lidaijfm/laravel-redirects)[ Packagist](https://packagist.org/packages/lidai/laravel-redirects)[ RSS](/packages/lidai-laravel-redirects/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (2)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 lidai/laravel-redirects

```

Publish the config file with:

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

```

Publish the migration file with:

```
php artisan vendor:publish --provider="Lidai\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 `Lidai\Redirects\Middleware\RedirectRequests` middleware.

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

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

### Creating redirects

[](#creating-redirects)

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

Using the `Lidai\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 `Lidai\Redirects\Models\Redirect` model's capabilities, please read the comments from `/config/redirects.php -> redirect_model`

Credits
=======

[](#credits)

- [LiamAird](https://github.com/lidaijfm)
- [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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.5% 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 ~149 days

Total

3

Last Release

1505d ago

Major Versions

0.0.1 → 1.02022-03-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/085128b122282b9a00b52f5f17fea907fc0c303263cdb4c09234de40ab5c0552?d=identicon)[lidai](/maintainers/lidai)

---

Top Contributors

[![LiamAird](https://avatars.githubusercontent.com/u/11542070?v=4)](https://github.com/LiamAird "LiamAird (6 commits)")[![lidaijfm](https://avatars.githubusercontent.com/u/85340036?v=4)](https://github.com/lidaijfm "lidaijfm (5 commits)")

---

Tags

urlsluglaravelredirectseo

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[fsasvari/laravel-trailing-slash

The package that adds redirection with trailing slash to Laravel framework.

63164.3k](/packages/fsasvari-laravel-trailing-slash)[sirodiaz/laravel-redirection

Laravel package that allows storing in database (or other sources) urls to redirect for SEO purposes

6316.0k](/packages/sirodiaz-laravel-redirection)[wazum/sluggi

TYPO3 extension for URL slug management with inline editing, auto-sync, locking, access control, and redirects

39488.5k](/packages/wazum-sluggi)[jaybizzle/safeurl

A Laravel package to create safe, SEO friendly urls

1786.1k1](/packages/jaybizzle-safeurl)[linkeys/signed-url

Enhanced signed URLs for Laravel, including attaching data, click limits and expiry.

2259.6k1](/packages/linkeys-signed-url)[illuminatech/model-route

Allows continuing route matching in case bound model does not exist

111.2k](/packages/illuminatech-model-route)

PHPackages © 2026

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