PHPackages                             bogddan/redirector - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. bogddan/redirector

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bogddan/redirector
==================

A comprehensive Laravel package for managing redirects with ease.

12.0k↓50%PHP

Since Dec 5Pushed 5mo agoCompare

[ Source](https://github.com/bogddan/redirector)[ Packagist](https://packagist.org/packages/bogddan/redirector)[ RSS](/packages/bogddan-redirector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

### Nested redirects for Laravel

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

[![Build Status](https://camo.githubusercontent.com/7c431a430e757e01c395589b65e0ca213d1600cbdcdf88e37a3176600639f405/68747470733a2f2f7472617669732d63692e6f72672f426f676464616e2f72656469726563746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Bogddan/redirector)[![StyleCI](https://camo.githubusercontent.com/13692b9bd1f338e85179b9786b04da91dae61e9f1ceb7bc8d5932f29abfbb6aa/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3434373537303935352f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/447570955?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/fbde0f1b0a7923bb8d4660d35a507b383b2f68d1d6f4299dac48c95f6a8b46db/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f426f676464616e2f72656469726563746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Bogddan/redirector/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/fced1cfdcb03b559860c0a4d2dc28295fb03b5e7ee81818780af170e8f495117/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f426f676464616e2f72656469726563746f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Bogddan/redirector/?branch=master)

- [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 Bogddan/redirector

```

Publish the config file with:

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

```

Publish the migration file with:

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

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

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

##### Creating redirects

[](#creating-redirects)

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

Using the `Bogddan\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 `Bogddan\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

24

—

LowBetter than 32% of packages

Maintenance49

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 59.4% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ebd8160e19b4dd4fbb18ac41537a6186681d9f1a2e2635ddf3c255191882ef6?d=identicon)[bogddan](/maintainers/bogddan)

---

Top Contributors

[![zbiller](https://avatars.githubusercontent.com/u/2579306?v=4)](https://github.com/zbiller "zbiller (38 commits)")[![Tofandel](https://avatars.githubusercontent.com/u/6115458?v=4)](https://github.com/Tofandel "Tofandel (16 commits)")[![lloricode](https://avatars.githubusercontent.com/u/8251344?v=4)](https://github.com/lloricode "lloricode (2 commits)")[![Bogdan-CIG](https://avatars.githubusercontent.com/u/130563890?v=4)](https://github.com/Bogdan-CIG "Bogdan-CIG (2 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")[![pideee](https://avatars.githubusercontent.com/u/23198327?v=4)](https://github.com/pideee "pideee (1 commits)")[![blaiselcq](https://avatars.githubusercontent.com/u/70012135?v=4)](https://github.com/blaiselcq "blaiselcq (1 commits)")[![bogddan](https://avatars.githubusercontent.com/u/7372065?v=4)](https://github.com/bogddan "bogddan (1 commits)")[![bacanu](https://avatars.githubusercontent.com/u/1362133?v=4)](https://github.com/bacanu "bacanu (1 commits)")

### Embed Badge

![Health badge](/badges/bogddan-redirector/health.svg)

```
[![Health](https://phpackages.com/badges/bogddan-redirector/health.svg)](https://phpackages.com/packages/bogddan-redirector)
```

###  Alternatives

[baidu/aip-sdk

baidu pulic ai php sdk

119104.9k6](/packages/baidu-aip-sdk)[thestringler-laravel/manipulator

A Laravel package for The Stringler

315.0k](/packages/thestringler-laravel-manipulator)

PHPackages © 2026

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