$config['base_url'] = 'localhost/project';
<link href="<?= base_url(); ?>/css/bootstrap.min.css" rel="stylesheet">
Would produce an error and it won't load my css on my view because of double '/'.
This is the pagesource of the view on a browser.
<link href="localhost/project//css/bootstrap.min.css" rel="stylesheet">
And the css won't load. When i try the page source and follow the link, it leads to 404 error.
What i'm confused about is that when i add protocol on my base_url on config file.
<link href="http://localhost/project//css/bootstrap.min.css" rel="stylesheet">
For reasons unknown, the above url seems to point to the css and it loads on my view even though it still has double '/' on the url between 'project' and 'css'. Also, even if i remove the '/' before the 'css' on the view, it will load, so long as i add a protocol on my base url even though without the protocol even with no double '/' it still won't load the css.
<link href="http://localhost/project/css/bootstrap.min.css" rel="stylesheet">
I also have some questions,
On my config base url above, i never put an '/' at the end so why does it add an '/' when i use the function base_url on my view. Why is it like this?
My 2nd question, is that the '/' on my url.
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="/css/shop-homepage.css" rel="stylesheet">
The first link when clicking on the url on the view pagesource on my browser, it still has the controller in the url.
http://localhost/project/Pages/css/bootstrap.min.css
While if i add a '/' before the 'css' it removes the 'project' and 'Pages' in the url.
http://localhost/css/shop-homepage.css
I could solve the problem just that i don't know why they occur so even though i can get my css to load i don't feel right because i don't know why.