Laravel 5 "www" and naked domain routing -


i ask approach should use handle naked domain routing in laravel 5? given scenario this, when user types in example.com, can use

route::group(['domain' => 'example.com'], function(){     route::get('/', function() {         return redirect::to(url::route('/'));     }); }); 

noted route('/') has been namespaced in route groups www.example.com

so question is, if user enters example.com/something/very/interesting, how should redirect user www.example.com/something/very/interesting ? bare in mind other actions. means @ point of time when user enters example.com/* bring user www.example.com/*

thank you

this more solved web server rather @ laravel level of things. if using apache check out this answer. if using nginx check out this answer.

you wanting force user www.example.com need update route group following;

route::group(['domain' => 'www.example.com'], function () {     // rest of routes }); 

Comments

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World