Download the PHP package bernhardh/nova-redirect-tester without Composer
On this page you can find all versions of the php package bernhardh/nova-redirect-tester. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package nova-redirect-tester
A Laravel Nova tool for testing redirects
This is a laravel nova tool, where you can test visually if all your redirects are working as expected.
Table of content
- Why should I use this package?
- Installation
- Create tests
- Editing Groups
- Examples
Why should I use this package?
If you have a lot of old urls you have redirected to new ones (for example you changed the url structure, migrated to laravel or introduced new language specific urls) and you are using Laravel Nova, then this package can help you have an eye on these redirects.
This is especially important to keep your visitors and SEO power by preventing broken redirects.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
After that, run the builtin migrations, which will create 2 tables:
nova_redirect_tester
: This are the testsnova_redirect_tester_groups
: With this, you can group your tests
Now you must register the tool with Nova. This is done in the tools method of the NovaServiceProvider
.
Now you will find the Redirect Tester menu entry in your Nova sidebar. Right now, there are no tests, please read on to find out, how to create new tests.
Create tests
You can either fill up the two database tables nova_redirect_tester
and nova_redirect_tester_groups
by yourself (for example with phpmyadmin) or you use Nova to manage this. The easiest way to to this, is to create the two Nova resources, by extending the package nova resources:
Now you can add a new test like any other nova resource.
Editing Groups
The Group resource is hidden by default in your sidebar. You can change that, by adding public static $displayInNavigation = true;
to your App\Nova\RedirectTestGroup
class.
Examples
If you wanna try it out, just add the following routes to your routes/web.php
:
and then add the following Redirect Tests
in nova:
Group | Status Code | Url From | Url To |
---|---|---|---|
Articles | 301 | /cms/categories/articles/my-first-article.htm | /articles/my-first-article |
Articles | 301 | /cms/categories/articles/the-2-article.htm | /articles/the-2-article |
Articles | 301 | /static-site/prices | /articles/prices |
Default | 404 | /this-url-does-not-exist | |
Default | 301 | /my-old-url | /this-test-will-fail |
This will result in the following: