Problems using base_url |
[eluser]skoots[/eluser]
Newbie here. I've set my base_url (in the config file)to Code: http://localhost.test/ but whenever I echo Code: base_url() Code: http://localhost.test/index.php//http//localhost.test/ I'm not using an .htaccess file. Is this something I can fix in the CI setup or am I having a server problem? Any help would be appreciated.
[eluser]Thorpe Obazee[/eluser]
if you want to link using an anchor then use anchor() Code: anchor()
[eluser]skoots[/eluser]
Thanks for the reply. Using Code: anchor() For example if I try to link to a stylesheet: Code: <link rel='stylesheet' href='<?=base_url()?>static/css/stylesheet.css' type='text/css' /> The resulting url is: Code: http://localhost.test/index.php//http//localhost.test/static/css/stylesheet.css ...which obviously wont work. Any ideas?
[eluser]skoots[/eluser]
Frustratingly enough it's the correct url: Code: http//localhost.test/ But it doesn't work with the stylesheet link or if I use it like this: Code: <a ><?php base_url($nav['path'])?>Link</a> The above results in a link that directs to: Code: http://localhost.test/index.php/http//localhost.test/(..etc) So it echos properly in the code, but the links don't work (particularly with the stylesheet) Might be an Apache thing...
[eluser]Thorpe Obazee[/eluser]
[quote author="skoots" date="1241774542"] Code: <a ><?php base_url($nav['path'])?>Link</a> I honestly doubt that this thing works though. I tried to make my url like yours and it's working just fine.
[eluser]skoots[/eluser]
Typo in the above code. But take the href for the stylesheet: Code: <link rel='stylesheet' href='<?=base_url()?>static/css/stylesheet.css' type='text/css' /> When I look at the source code through the browser I get: Code: <link rel='stylesheet' href='http//localhost.test/static/css/stylesheet.css' type='text/css' /> But that href tries to load the stylesheet from http://localhost.test/index.php/http//lo...esheet.css - somehow Code: http://localhost.test/index.php
[eluser]skoots[/eluser]
bargainph thanks for your replies I think I'll move on here - it's a small site so I'll hard code the links and I'll see if the problem is resolved when it's on a different server. Seems like it may be a problem with my Apache setup. thanks again.
[eluser]Thorpe Obazee[/eluser]
It probably is a server side problem. Good luck
[eluser]xwero[/eluser]
skoots whate are your base_url and index settings in the config.php file |
Welcome Guest, Not a member yet? Register Sign In |