Download the PHP package spatie/laravel-missing-page-redirector without Composer

On this page you can find all versions of the php package spatie/laravel-missing-page-redirector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-missing-page-redirector

Redirect missing pages in your Laravel application

Latest Version on Packagist run-tests Total Downloads

When transitioning from a old site to a new one your URLs may change. If your old site was popular you probably want to retain your SEO worth. One way of doing this is by providing permanent redirects from your old URLs to your new URLs. This package makes that process very easy.

When installed you only need to add your redirects to the config file. Want to use the database as your source of redirects? No problem!

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

The package will automatically register itself.

Next you must register the Spatie\MissingPageRedirector\RedirectsMissingPages-middleware:

Finally you must publish the config file:

This is the contents of the published config file:

Usage

Creating a redirect is easy. You just have to add an entry to the redirects key in the config file.

You may use route parameters like you're used to when using Laravel's routes:

Optional parameters are also... an option:

Finally, you can use an asterix (*) as a wildcard parameter that will match multiple URL segments (see encoded URL slashes in the Laravel docs for more info). This is useful when you want to redirect a URL like /old-blog/foo/bar/baz to /new-blog/foo/bar/baz.

By default the package only redirects if the request has a 404 response code but it's possible to be redirected on any response code. To achieve this you may change the option to an array of response codes or leave it empty if you wish to be redirected no matter what the response code was sent to the URL. You may override this using the following syntax to achieve this:

It is also possible to optionally specify which http response code is used when performing the redirect. By default the response code is set. You may override this using the following syntax:

Events

The package will fire a RouteWasHit event when it found a redirect for the route. A RedirectNotFound is fired when no redirect was found.

Creating your own redirector

By default this package will use the Spatie\MissingPageRedirector\Redirector\ConfigurationRedirector which will get its redirects from the config file. If you want to use another source for your redirects (for example a database) you can create your own redirector.

A valid redirector is any class that implements the Spatie\MissingPageRedirector\Redirector\Redirector-interface. That interface looks like this:

The getRedirectsFor method should return an array in which the keys are the old URLs and the values the new URLs.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-missing-page-redirector with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
laravel/framework Version ^8.28|^9.0|^10.0|^11.0
spatie/url Version ^1.0|^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package spatie/laravel-missing-page-redirector contains the following files

Loading the files please wait ....