简体   繁体   中英

CodeIgniter 3 base_url function returns wrong url

I am using XAMPP, MySQL and CodeIgniter.

I already included,

$autoload['helper'] = array('url');

in autoload.php.

<?php echo base_url(); ?>

returns http://::1/mysite/ instead of http://localhost/mysite/ .

Can anyone help me with this issue?

You need to make sure you have set your base_url in. Most likely because you left it blank. This is a common thing that people do not know about or forget to do.

application > config > config.php

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

One of the issues when you try to submit form with out base url not set is will not go to correct url, when you try to submit a form so that why in codeigniter 3 all ways best to set your base_url even though not a requirement.

Also here are some htaccess for codeigniter xampp & wamp

Htaccess For Codeigniter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM