0

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...

2
  • ::1 is the IPv6 loopback address, just as 127.0.0.1 is the IPv4 loopback address. It's just the IP representation of localhost and should still work. I wouldn't bother too much about how the URL looks on your local development environment as long as it works. Commented Dec 16, 2015 at 8:48
  • @Oldskool if i paste the ipv6 url to browser then it will go to google.... Commented Dec 16, 2015 at 8:57

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

2

Please add your base url here

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

1 Comment

Need to be with trailing slash.
0

This might work.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.