PHPackages                             the-3labs-team/nova-redirector-seo - 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. the-3labs-team/nova-redirector-seo

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

the-3labs-team/nova-redirector-seo
==================================

Redirector SEO for Laravel Nova

v1.0.3(1mo ago)14.0k↓25%3[2 PRs](https://github.com/The-3Labs-Team/nova-redirector-seo/pulls)MITPHPPHP ^8.1|^8.2|^8.3|^8.4CI passing

Since Jan 18Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/The-3Labs-Team/nova-redirector-seo)[ Packagist](https://packagist.org/packages/the-3labs-team/nova-redirector-seo)[ Docs](https://github.com/the-3labs-team/nova-redirector-seo)[ RSS](/packages/the-3labs-team-nova-redirector-seo/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (22)Versions (16)Used By (0)

Redirector SEO for Laravel Nova
===============================

[](#redirector-seo-for-laravel-nova)

[![Latest Version on Packagist](https://camo.githubusercontent.com/92e393d557876861a847526987c8dd252b4607925a3e4badef2ec826e4d003a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468652d336c6162732d7465616d2f6e6f76612d72656469726563746f722d73656f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/the-3labs-team/nova-redirector-seo)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0e752aa2c0def8f4ea96a5ae02f7406a65461fe110209c93c182c7769633ddb7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7468652d336c6162732d7465616d2f6e6f76612d72656469726563746f722d73656f2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/the-3labs-team/nova-redirector-seo/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b614237012adc5e2f62c1b0d38ce4b65fde4172c97db7a3625d233fb57830714/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7468652d336c6162732d7465616d2f6e6f76612d72656469726563746f722d73656f2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/the-3labs-team/nova-redirector-seo/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/c4e40d89a49e771797284f3725c445654222e7d55f88885fb8f7c803cb330a3a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468652d336c6162732d7465616d2f6e6f76612d72656469726563746f722d73656f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/the-3labs-team/nova-redirector-seo)

NovaRedirectorSEO is a all-in-one SEO package for Laravel Nova. It provides a simple way to manage your SEO redirects.

[![Demo Redirector SEO Laravel Nova](./assets/demo.gif)](./assets/demo.gif)

Why choose NovaRedirectorSEO?

- **Pre-configured Laravel Nova resource**, you need only to install, register and configure the package.
- **Middleware** to handle redirects, you can use it in your routes or in your controllers.
- **Cache support**, based on your configuration, the package will cache the redirects. Also, it flush caches when you create, update or delete a redirect.
- **Regex support**, you can use regex in your redirects.

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

[](#installation)

You can install the package via composer:

```
composer require the-3labs-team/nova-redirector-seo
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="nova-redirector-seo-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --tag="nova-redirector-seo-config"
```

This is the contents of the published config file:

```
return [
    'cache' => [
        'ttl' => 60 * 60 * 24 * 7, // 7 days
    ],
];
```

It will use the default cache driver configured in your `config/cache.php` file.

If you want to disable the cache, you can set the `ttl` to `null`.

Usage
-----

[](#usage)

Now it's time to configure the package.

### Nova resource

[](#nova-resource)

First, register the `NovaRedirectorSeo` tool in your `/app/Providers/NovaServiceProvider.php` (you will probably have to add the entire function):

```
    /**
     * Register the application's Nova resources.
     *
     * @return void
     */
    protected function resources()
    {
        Nova::resourcesIn(app_path('Nova'));

        Nova::resources([
            \The3LabsTeam\NovaRedirectorSeo\App\Nova\NovaRedirectorSeo::class,
        ]);
    }
```

Now you can access the tool in your Nova panel, under the "SEO" menu.

### Middleware

[](#middleware)

NovaRedirectorSeo is provided with a middleware that will redirect the user to the correct URL, if the current URL is not the correct one.

You can add this middleware to your `app/Http/Kernel.php` file:

```
    protected $middleware = [
        \The3LabsTeam\NovaRedirectorSeo\App\Http\Middleware\NovaRedirectorSeoMiddleware::class,
        //...
```

### Policies

[](#policies)

You can add a policy to the NovaRedirectorSeo resource, to restrict the access to the resource.

First, you need to create a policy for the NovaRedirectorSeo resource:

```
php artisan make:policy NovaRedirectorSeoPolicy
```

Then, register the policy in your `app/Providers/AuthServiceProvider.php` file:

```
    protected $policies = [
        'The3LabsTeam\NovaRedirectorSeo\App\Models\NovaRedirectorSeo' => 'App\Policies\NovaRedirectorSeoPolicy',
    ];
```

If you need, you can use this policy as a template:

```
