I am having a problem with Codeigniter that duplicates base_url. If I visit the index page in the controller, all the URLs are fine, but when I visit the page which is not the index page in the controller (cooling in my case), I get strange duplicate URLs like thishttp://www.mypage.si/www.mypage.si/services/colling
for example
This is my service manager
class Services extends CI_Controller {
public function index() {
$this->load->view('header');
$this->load->view('main');
$this->load->view('footer');
}
public function cooling() {
$this->load->view('header');
$this->load->view('cooling');
$this->load->view('footer');
}
}
my .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
config.php
$config['base_url'] = 'www.mypage.si/';
$config['index_page'] = '';
This is my HTML.
<li><a href="<?php echo base_url('services/cooling'); ?>">cooling</a></li>
<img src="assets/images/logo.png" />
<li><a href="<?php echo base_url()."services/cooling"; ?>">cooling</a></li>
Thank you in advance!
source
share