简体   繁体   English

CodeIgniter重定向,以[:: 1]替换本地URL

[英]CodeIgniter redirects replacing localhost URL with [::1]

I'm currently writing an application where I extend the CI_Controller class and check if a user is logged in, if they aren't I redirect them to the login page. 我当前正在编写一个应用程序,在其中扩展CI_Controller类并检查是否已登录用户,如果不是,则将其重定向到登录页面。

However, I'm finding that whenever I do this, my the URL it redirects to, changes from localhost/~username/ to [::1]/~username/ 但是,我发现每次执行此操作时,重定向到的URL都会从localhost /〜username /更改为[:: 1] /〜username /

The system I'm using is OS X Yosemite and using safari 我正在使用的系统是OS X Yosemite,并使用了野生动物园

I've searched everywhere, but with no luck. 我到处搜寻,但没有运气。 Any ideas as to the cause of this and how to solve it? 关于此问题的原因以及如何解决的任何想法?

May be your base_url is empty. 可能是您的base_url为空。

Setup the base_url 设置base_url

In config/config.php config/config.php

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

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

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