Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/OwenMelbz/domain-enforcement
Laravel 5+ Middleware to enforce a single domain on your application. e.g non-www. to www.
https://github.com/OwenMelbz/domain-enforcement
laravel-5-package non-www redirect www
Last synced: 8 days ago
JSON representation
Laravel 5+ Middleware to enforce a single domain on your application. e.g non-www. to www.
- Host: GitHub
- URL: https://github.com/OwenMelbz/domain-enforcement
- Owner: OwenMelbz
- Created: 2017-05-26T06:57:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-22T12:49:20.000Z (over 4 years ago)
- Last Synced: 2024-09-18T13:16:21.061Z (about 2 months ago)
- Topics: laravel-5-package, non-www, redirect, www
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 23
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel 5+ Domain / APP_URL Enforcement
An automatic piece of middleware for Laravel 5+, which will force users to access your application via what is defined in the APP_URL - especially useful for SEO forcing non-www users to www etc, unless specified in the ignore list
## Usage
1. Install via composer `composer require owenmelbz/domain-enforcement`
2. Register the service provider - typically done inside the `app.php` providers array e.g `OwenMelbz\DomainEnforcement\DomainEnforcementServiceProvider::class`
3. Add `ENFORCE_DOMAIN=true` to your application environment config e.g `.env`
4. Enjoy your stress free architecture agnostic redirects
## Configuration
If you publish the config via `php artisan vendor:publish --provider="OwenMelbz\DomainEnforcement\DomainEnforcementServiceProvider"` you can exclude urls from getting enforced.
## Why?
Too often we've wasted time configuring redirections, with proxy systems like CloudFlare, with apache development machines and nginx production, this removes all the headache and can simply be turned off and on at a whim.