PHPackages                             internetguru/laravel-smart-redirect - 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. internetguru/laravel-smart-redirect

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

internetguru/laravel-smart-redirect
===================================

A configurable Laravel 11 middleware package that handles URL redirection based on defined routes and uses Levenshtein distance to find the closest matching route for 404 errors.

v0.1.9(2mo ago)01.1kMITPHP

Since Jul 31Pushed 2mo ago2 watchersCompare

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

READMEChangelogDependenciesVersions (14)Used By (0)

Laravel Smart Redirect
======================

[](#laravel-smart-redirect)

A configurable Laravel 11 middleware package that handles URL redirection based on defined routes and uses Levenshtein distance to find the closest matching route for 404 errors.

Features
--------

[](#features)

- Redirect URLs based on predefined rules
- Automatically find the closest matching route using Levenshtein distance
- Easily configurable parameters for route combinations

Installation
------------

[](#installation)

1. Require the package via Composer:

    ```
    composer require internetguru/laravel-smart-redirect
    ```
2. Publish the configuration file:

    ```
    php artisan vendor:publish --provider="Internetguru\\SmartRedirect\\SmartRedirectServiceProvider" --tag="config"
    ```
3. Register the service provider (if not auto-discovered) in `config/app.php`:

    ```
    'providers' => [
        // Other Service Providers
        Internetguru\SmartRedirect\SmartRedirectServiceProvider::class,
    ],
    ```

Configuration
-------------

[](#configuration)

After publishing the configuration file, you can configure your redirects and parameters in `config/smart-redirect.php`.

```
return [
    'redirects' => [
        // '/old-path' => '/new-path',
    ],
    'params' => [
        // 'locale' => ['en', 'cs'],
        // 'location' => ['racineves', 'kralupy'],
    ],
];
```

Usage
-----

[](#usage)

To always use the middleware, add it to `app/Http/Kernel.php`:

```
protected $middlewareGroups = [
    'web' => [
        // Other Middleware
        \Internetguru\SmartRedirect\Middleware\Redirect::class,
    ],
];
```

You can also use the middleware only for some of the routes. Register the middleware in `app/Http/Kernel.php`:

```
protected $routeMiddleware = [
    'smart-redirect' => \Internetguru\SmartRedirect\Middleware\Redirect::class,
];
```

And then use it in your routes, e.g. in `routes/web.php`:

```
Route::get('/old-path', function () {
    return 'This is the old path.';
})->middleware('smart-redirect');
```

Example
-------

[](#example)

Let's say you have a website with the following routes:

- `/`
- `/about`
- `/contact`
- `/services`
- `/services/web-development`
- `/services/mobile-development`
- `/services/seo`

And you want to redirect the following URLs:

- `/web-dev` to `/services/web-development`
- `/mobile-dev` to `/services/mobile-development`
- `/seo` to `/services/seo`

You can define the redirects in `config/smart-redirect.php`:

```
'redirects' => [
    '/web-dev' => '/services/web-development',
    '/mobile-dev' => '/services/mobile-development',
    '/seo' => '/services/seo',
],
```

Now, when you visit `/web-dev`, you will be redirected to `/services/web-development`.

If you visit a non-existing URL, e.g. `/web`, the middleware will automatically find the closest matching route and redirect you to the correct one.

License &amp; Commercial Terms
------------------------------

[](#license--commercial-terms)

### License

[](#license)

Copyright © 2026 **Internet Guru**

This software is licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)](http://creativecommons.org/licenses/by-nc-sa/4.0/) license.

> **Disclaimer:** This software is provided "as is", without warranty of any kind, express or implied. In no event shall the authors or copyright holders be liable for any claim, damages or other liability.

### Commercial Use

[](#commercial-use)

The standard CC BY-NC-SA license prohibits commercial use. If you wish to use this software in a commercial environment or product, we offer **flexible commercial licenses** tailored to:

- Your company size.
- The nature of your project.
- Your specific integration needs.

**Note:** In many instances (especially for startups or small-scale tools), this may result in no fees being charged at all. Please contact us to obtain written permission or a commercial agreement.

**Contact for Licensing:**

### Professional Services

[](#professional-services)

Are you looking to get the most out of this project? We are available for:

- **Custom Development:** Tailoring the software to your specific requirements.
- **Integration &amp; Support:** Helping your team implement and maintain the solution.
- **Training &amp; Workshops:** Seminars and hands-on workshops for your developers.

Reach out to us at  — we are more than happy to assist you!

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance85

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~64 days

Recently: every ~93 days

Total

10

Last Release

77d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b52abb7d16d42d5abe09b797fc4da8186dc507caf8a62f4e1b88b0448edca4f8?d=identicon)[internetguru](/maintainers/internetguru)

---

Top Contributors

[![petrzpav](https://avatars.githubusercontent.com/u/1113912?v=4)](https://github.com/petrzpav "petrzpav (39 commits)")

### Embed Badge

![Health badge](/badges/internetguru-laravel-smart-redirect/health.svg)

```
[![Health](https://phpackages.com/badges/internetguru-laravel-smart-redirect/health.svg)](https://phpackages.com/packages/internetguru-laravel-smart-redirect)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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