I have recently started messing round with CodeIgniter and ran into problems when doing standard hyperlinks through either HTML or using the anchor function, as all hyperlinks append my server route on the start. So say for example I had written a standard hyperlink in my view such as <a href="www.testsite.com">Test site</a> it would return http://localhost/test/index.php/test/www.testsite.com when I click the link?
I’m not sure what I’m doing wrong, but guessing it maybe something to do with routing?
I have recently started messing round with CodeIgniter and ran into problems when doing
Share
The problem is that you have not added the protocol in front of the link in your view. Your browser is assuming that
www.testsite.comis an internal link and treating it exactly the same as it would treattest/path/to/resource.php(as a relative link).Add an
http://to the front of your URL (in the view code) and everything should just work.