简体   繁体   English

无法在codeigniter应用中获得正确的base_url

[英]not getting proper base_url in codeigniter app

i am getting this type of url when trying to access pages other than index page 当尝试访问除索引页面以外的页面时,我得到了这种类型的URL

http://localhost:8012/health-care/8012//localhost/health-care/index.php/index.php/home

but url to access page must be 但访问页面的网址必须是

http://localhost:8012/health-care/index.php/home

my problem in url is: "it is duplicating url after "ih http://localhost:8012/healthcare/ that should not be duplicated. 我在url中遇到的问题是:“它是在不应该重复的http://localhost:8012/healthcare/之后重复的url。

i have autoloaded url helper in autoload.php as well as manually in constructor of controller. 我已经在autoload.php中以及在控制器的构造函数中手动加载了url helper。 my base_url in conf 我在conf中的base_url

$config['base_url'] = 'http//localhost:8012/health-care/index.php/';

Guide me about this problem. 指导我有关这个问题。

in addition to tell you that i have two app fron one codeigniter ie frontend and backend. 除了告诉你,我有两个app fron一个codeigniter,即前端和后端。

Url for backend works properly but for frontend its giving me mistakes what to do ? 后端网址正常工作,但前端网址给我错误,该怎么办?

$config['base_url'] = 'http//localhost:8012/health-care/';

used this base url you getting this url 用这个基本网址,你得到这个网址

http://localhost:8012/health-care/index.php/home HTTP://本地主机:8012 /保健/ index.php文件/家

Y0u have to change this line Y0u必须更改此行

http://localhost:8012/health-care/index.php/home

to this 对此

$config['base_url'] = 'http//localhost:8012/health-care/';

Please have a try. 请尝试一下。

Try this code: 试试这个代码:

$config['base_url'] = 'http://localhost:8012/health-care/';

and also make index_page as empty like this: 并且将index_page为空,如下所示:

$config['index_page'] = '';

.htaccess file was not working. .htaccess文件不起作用。 just replaced file and my problem got solved. 刚替换文件,我的问题就解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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