New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

owenmelbz/domain-enforcement

Laravel 5+ middleware to enforce a single domain on your application. e.g non-www. to www.
4,914 23
Install
composer require owenmelbz/domain-enforcement
Latest Version:0.0.7
Older releases:5
License:MIT
Last Updated:Mar 22, 2020
Links: GitHub  ·  Packagist
Maintainer: OwenMelbz

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.

Related Packages

owenmelbz/https-enforcement

Laravel 5.x middleware to enforce https redirection for your app.

2,597 25
yaroslawww/laravel-force-https

Easy redirect to https for Laravel.

9,747 12
ssx/threeohone

A simple Laravel package to deal with handling 301 redirects.

1,204 1
tofandel/laravel-redirects

Nested URLs redirect logic for Laravel

7,540 3

Version History

Version Released Laravel License
0.0.7 MIT
0.0.6 5.* MIT
0.0.5 5.* MIT
0.0.4 5.* MIT
0.0.3 5.* MIT