Reputation: 268
href will come with baseurl inside it, src wont.
How do i not let href contain baseurl? it's added automatically. I tried to echo it , it doesnt show baseurl unless it's inside href.
Anyway i can display just the raw url? $item->link has it's own baseurl already.
Code
<a target="_blank" href="{{$item->link}}"><img src="{{$item->img_link}}" /></a>
Upvotes: 0
Views: 345
Reputation: 1814
I think it is to do with how href attribute works, rather than anything else.
If the link given in the href attribute doesn't have "http://", it always links to baseURL/HREF_ATTRIBUTE, but if it has "http://", it takes HREF_ATTRIBUTE as the complete URL.
you can try it out separately by creating an index.php file, inside test folder and putting below line
<a target="_blank" href="www.xyz.com">Hello</a>
This will refer to localhost/test/www.xyz.com
But if you change it as
<a target="_blank" href="http://www.xyz.com">Hello</a>
This will refer to www.xyz.com.
Upvotes: 1