c6digital/laravel-site-redirect
A small package to redirect all requests elsewhere.
Maintainers
Package info
github.com/c6digital/laravel-site-redirect
pkg:composer/c6digital/laravel-site-redirect
Requires
- php: ^8.2
- illuminate/contracts: ^11.0 || ^12.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1 || ^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9 || ^8.0
- orchestra/testbench: ^9.0 || ^10.0
- pestphp/pest: ^2.0 || ^3.0
- pestphp/pest-plugin-arch: ^2.0 || ^3.0
- pestphp/pest-plugin-laravel: ^2.0 || ^3.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.10 || ^2.0
- phpstan/phpstan-deprecation-rules: ^1.0 || ^2.0
- phpstan/phpstan-phpunit: ^1.0 || ^2.0
- spatie/invade: ^1.1
- spatie/laravel-ray: ^1.26
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT 949501b1036af49b304b317912099292585f9080
- Ryan Chandler <support.woop@ryangjchandler.co.uk>
This package is auto-updated.
Last update: 2026-06-20 07:58:21 UTC
README
👁 Latest Version on Packagist
👁 GitHub Tests Action Status
👁 GitHub Code Style Action Status
👁 Total Downloads
This package can be used to redirect all requests to a site elsewhere with the flick of an environment variable.
Installation
You can install the package via Composer:
composer require c6digital/laravel-site-redirect
You can publish the config file with:
php artisan vendor:publish --tag="laravel-site-redirect-config"
Usage
Use environment variables to enable & disable the redirect and configure the redirect location.
SITE_REDIRECT_ENABLED=true SITE_REDIRECT_LOCATION=https://my-site.test
The middleware that handles the redirect is registered globally by the package.
Bypassing redirects
There are times when you want to allow somebody to bypass the redirect mechanism. This can be achieved with a "bypass token".
Start by specifying the bypass token as an environment variables.
SITE_REDIRECT_BYPASS_TOKEN=example-token
To bypass the redirect, simply provide the bypass token in the query string of the request.
https://my-site.test/?bypass_token=example-token
This will let you access the site as normal. The bypass will be active for 1 hour so subsequent requests will not require a token.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
