PHP code example of 1970mr / laravel-redirector

1. Go to this page and download the library: Download 1970mr/laravel-redirector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

1970mr / laravel-redirector example snippets


use Mr1970\LaravelRedirector\Middlewares\HandleRedirects;

Route::middleware([HandleRedirects::class])->group(function () {
    // Your routes here
});

->withMiddleware(function (Middleware $middleware) {
     $middleware->append(\Mr1970\LaravelRedirector\Middlewares\HandleRedirects::class);
})

// Using alias
Route::middleware(['redirector'])->group(function () {
    // Your routes here
});

// Using class name
Route::middleware([\Mr1970\LaravelRedirector\Middlewares\HandleRedirects::class])->group(function () {
    // Your routes here
});
bash
php artisan vendor:publish --provider="Mr1970\LaravelRedirector\RedirectorServiceProvider"
bash
php artisan migrate
bash
    php artisan redirect:create /old-page /new-page 301 1
    
bash
php artisan redirect:update {source_url} {destination_url} {status_code=301} {is_active=1}
bash
php artisan redirect:update /old-page /new-destination 302 1
bash
php artisan redirect:delete {source_url}
bash
php artisan redirect:delete /old-page
bash
php artisan redirect:list
bash
php artisan redirector:install