I have been using Codeigniter,suddenly i am facing a strange problem. I downloaded CI-2.2.6 and put it under my WAMP root.So For my project i linked all the CSS and JS in a page_head file using SITE_URL function. But somehow it didn't work when i open the page source i get this link
<link href="http://::1/portal/css/jquery-ui.css" rel="stylesheet">
which instead should be:
<link href="http://localhost/portal/css/jquery-ui.css" rel="stylesheet">
When i type in 127.0.0.1 and then my project its works perfectly fine. How do i make same things possible for localhost/projectname
A friend of mine told me that it was IPV6 error/issue. So what changes should i do to make my site_url as localhost/projectname instead of https://::1/project
I would use the url helper feature
$this->load->helper('url');
Or you can autoload it in application > config > autoload.php
Then you can use
<?php echo base_url('assets/css/jquery-ui.css');?>
Use site url on controllers and base url on views I find works better.
On View
<link type="text/css" rel="stylesheet" href="<?php echo base_url('assets/css/jquery-ui.css');?>">
Directory Layout
application
assets > css
assets > js
assets > images
system
.htaccess
index.php
On the application > config > config.php do not leave base url blank
$config['base_url'] = 'http://localhost/portal/';
// If need to remove index.php make blank
$config['index_page'] = '';
Also when you use wamp and need to have a htacess file on main directory make sure you have enabled Apache modules rewrite module
Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|assets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]