Code Monkey home page Code Monkey logo

seo's Introduction

Laravel SEO Tools

Total Downloads Latest Stable Version License Build Status

A laravel 5 package that adds the ability to log 404 errors and to action these with redirects via a user interface. This has several benefits over creating redirect in a .htaccess (Or your web servers equivalent) as the main laravel application will run and then 404 if a page cannot be found, this is where the package will determine whether there is a redirect available. This prevents scenarios where a redirect may be hit before laravel and limiting access to your application. On top of this, it gives SEO members the ability to track 404 errors, tracking where they have come from and then action them with ease.

Installation

Install the package with composer

composer require knash94\seo

Once installed, add the following line into your config/app.php service providers

'Knash94\Seo\SeoServiceProvider'

Then open your \App\Exceptions\Handler.php file and insert the following code under the render method, be sure not to change any existing code on the method

$redirect = $this->reportNotFound($exception);

if ($redirect && $redirect instanceof RedirectResponse) {
    return $redirect;
}

Also add the LogsMissingPages trait to \App\Exceptions\Handler.php

use LogsMissingPages;

Also import the Illuminate\Http\RedirectResponse; in App\Exceptions\Handler.php

Finally, publish the vendor files and run the migrations by running these commands

php artisan vendor:publish --provider=Knash94\Seo\SeoServiceProvider
php artisan migrate

Configuration

There are various configuration options to choose from, I'd recommend setting the middleware, template and section values. Simply open seo-tools.php and set the new values. Below is an example setup using your own template

<?php

return [
    'routing' => [
        'prefix' => 'admin/seo-tools',
        'namespace' => 'Knash94\Seo\Http\Controllers',
        'middleware' => ['auth']
    ],

    'views' => [
        'template' => 'layout.admin',
        'section' => 'content',
        'index' => 'seo-tools::bootstrap3.index',

        'errors' => [
                    'edit' => 'seo-tools::bootstrap3.errors.edit',
                    'view' => 'seo-tools::bootstrap3.errors.view'
                ],
        
                'redirects' => [
                    'edit' => 'seo-tools::bootstrap3.redirects.edit',
                    'delete' => 'seo-tools::bootstrap3.redirects.delete'
                ]
        ],
        
        // Filters what URLs to not record using regex
        'filters' => [
            '/(\.png)|(\.jpg)|(\.gif)/',
            '/wp\-login\.php/'
        ]
];

If you want to link the redirect manager into your admin panel, then create a link to the seo-tools.index route

Todo

  • Testing suite
  • Ability to test if a redirect works as intended before applying the change
  • To mass insert redirects
  • Ability to add regex into redirects

seo's People

Contributors

knash94 avatar midnite81 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

seo's Issues

Pagination on view request page

Viewing requests on the admin for an error shows all of the requests at once.
Some errors can have 1k-5k+ requests.

Pagination would be nice :)

Show time of request

On the view requests admin page it does not show the timestamp of the request.
This is stored in the database, would also be useful.

Show if a HTTP error has a redirect already

Another enhancement/suggestion:

When viewing HTTP errors it shows how many requests people have made on it.
However, showing if it has a redirect linked to it already would be useful if a site has 9k+ HTTP errors.

Just so we know if an error needs a redirect added without looking for it in the redirects tab.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.