questionasker
questionasker

Reputation: 2697

PHP Codeigniter site_url produce HTML link error

in my view, i try to print URL to my controller, below the code :

<p id="demo">
<a href="<?php echo site_url('HT');?>"> Goto Controller </a>
</p>

However those code provide HTML link error like this :

<a href="http://::1/cidLab/index.php/HT"> Goto Controller </a>

The link should be go to http://localhost/cidLab/index.php/HT but why must http://::1/ ?

I've try to use base_url, but still face same Error...

Upvotes: 0

Views: 1789

Answers (3)

HEMAL
HEMAL

Reputation: 430

Please add your base url here

$config['base_url'] = 'http://localhost/project';

Upvotes: 2

MERT DOĞAN
MERT DOĞAN

Reputation: 3106

This is about Codeigniter changed it's config structure. After version 3.0.3, you must configure

$config['base_url'] = '';

in config.php file at application/config folder.

This change is about security rules. They says, empty base_url may be security hole.

Base url must be your site url. If you test your application in local, you may set this url as localhost

Upvotes: 2

Dsilva Valantan
Dsilva Valantan

Reputation: 1

This might work.

<a href="<?php echo site_url('/cidLab/index.php/HT');?>"

Upvotes: 0

Related Questions