You have to include the scheme (eg https) in the link — otherwise it’ll be treaded as relative to the current page. In other words, you’ll want the whole
You don’t include any info about how you’re getting this information from the user, but it would be a good practice to check it using something like RegEx for a scheme and append one if it doesn’t exist.
I am trying to make users input links into their posts, onto a post page called mysite.com/subfolder/ using a form input.
In the result, if someone enters google.com, it displays
when clicking on the link, it doesn’t go to google.com, instead it links to mysite.com/subfolder/google.com.
Is there a way to prevent this from happening?
*Edit: I fixed this by entering making the input url, but other solutions would be great!
Thank you! I was using a form with a input tag to enter the URLs, but I’ll look into what you mentioned.
If you include some code about how your accept and store that info, you might get a more specific response. Otherwise, feel free to upvote and or accept my answer