I have added a link to my webpage like this:
<a alt="English" href="{{ route('english.version') }}">En</a>
And here is the route english.version
:
Route::get('/en', function () {
redirect(url('https://websitename.com/landing'));
})->name('english.version');
But now whenever I click on the link En, I get this error:
Forbidden You don't have permission to access this resource.
So the question is, how can I be able to show /en
link, and when users clicked on it, it redirect another url which is https://websitename.com/landing
in this case?
CodePudding user response:
It should return from closure then it will redirect you to target.
Route::get('/en', function () {
return redirect(url('https://websitename.com/landing'));
})->name('english.version');
That's the only issue right now. Please try it and let me know. Thanks