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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -