Laravel Packages

Manage Application Redirects with the Laravel Redirection Package

Published
Manage Application Redirects with the Laravel Redirection Package image

Laravel Redirection is a Laravel +8 package to manage URL redirections inside your Laravel application. It's capable of using different data sources to store redirects and allows better SEO support for your application.

The Redirection package supports a config and database driver out of the box, and you can create a custom driver to fit your needs. You could provide a UI to add and manage redirects for your applications using the database driver, for example.

If you need to enhance the model provided by this package, you can extend the package's model and configure the package to use the extended model:

namespace App\Models;

use SiroDiaz\Redirection\Models\Redirection;

class Redirect extends Redirection
{
    /* ... */
}

To get started with this package, you can use the config driver to test and add redirects to the published config quickly:

return [
    // ...
    'urls' => [
        '/old/url' => '/new/url',
        '/another/old/url' => '/another/new/url',
        '/url/with?id=123' => '/url/with/123',
    ],
];

You can also specify which type of redirect status code a match should use:

return [
    'urls' => [
        '/old/url' => ['new_url' => '/new/url', 'status_code' => 302],
        '/another/old/url' => '/another/new/url',
        '/url/with?id=123' => ['new_url' => '/url/with/123'],
    ],
];

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
Laravel AI SDK 1.4 Lets Agents Recover From Tool Failures image

Laravel AI SDK 1.4 Lets Agents Recover From Tool Failures

Read article
Laravel Read Replicas: Check if a Replica Has Caught Up image

Laravel Read Replicas: Check if a Replica Has Caught Up

Read article
UUID Request Input and Migration Failure Events in Laravel 13.42 image

UUID Request Input and Migration Failure Events in Laravel 13.42

Read article
Replay Missed Laravel Scheduled Tasks With Schedule Catchup image

Replay Missed Laravel Scheduled Tasks With Schedule Catchup

Read article
Search Polymorphic Relations and Filament Tables With Laravel Searchable image

Search Polymorphic Relations and Filament Tables With Laravel Searchable

Read article
Laravel Rest Api 3.0: Typed Fields, Metrics, and OpenAPI Docs image

Laravel Rest Api 3.0: Typed Fields, Metrics, and OpenAPI Docs

Read article