PHP code example of davidyell / seo-redirector

1. Go to this page and download the library: Download davidyell/seo-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/ */

    

davidyell / seo-redirector example snippets


// Direct matching
$redirects = [
    '/examples/first' => [
        'target' => '/tutorials/first',
        'code' => 301
    ]
];

// Slug matching
$redirects = [
    '/examples/:slug/first' => [
        'target' => '/tutorials/:slug/first',
        'code' => 301
    ],
    'examples/:slug' => [
        'target' => '/tutorials/:slug',
        'code' => 302
    ]
];

// Greedy matching
$redirects = [
    '/examples/*' => [
        'target' => '/tutorials',
        'code' => 301
    ]
];