How can I do to redirect out of my website in Laravel? I have already tried with Redirect :: away () but it did not. I saw some solutions with javascript but wanted to look for other ways.
According to the image inserted in the question, you can see that the $location->url
value is "www.google.com".
The value does not contain the protocol, ie it does not inform if the protocol is http
, https
, etc ...
When this occurs, the browser understands that the value entered in the href
property is relative to the current URL, that is:
If you add a slash at the beginning, without protocol, the browser understands that the value entered in the href
property is relative to the domain:
To resolve the issue, you must enter the desired protocol, for example, the https
protocol:
<small><a href="https://{{ $location->url }}" target="_blank">Url mapa</a><small>
However, if it is a dynamic system, the protocol should not be defined in HTML, as it may be different for each URL.