Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rohansinghrawat's avatar

Codeigniter 3 project running in local redirects to live url after login in mac with nginx server?

I am currently working on one codeigniter project and i've setup it in my local machine . I have mac and using nginx for web server so the problem is i have setup my CI project locally .. and also i have made an entry for nginx localhost entry

server {
        listen       80;
        server_name  dine.localhost;
        index index.php index.html index.htm;
        root /var/www/resort/index.php;

        #access_log  logs/host.access.log  main;

        location / {
            try_files $uri $uri/ /index.php?$args;
        }

        location /ws/ {
            try_files $uri $uri/ /ws/index.php$is_args$args;
        }

        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

now the best part is i am able to locally get that login page but when i hit my login button i redirected to my live url and I know the reason as in my config i have setup my live url in $config['base_url'] path But the problem is when i remove that base url my localhost CI project does not run properly

So please suggest where i am doing wrong or how to run my CI project in mac locally using nginx server.

0 likes
7 replies
automica's avatar

when i hit my login button i redirected to my live url

where have you set your live url? ensure you have updated the appropriate .env and clear caches.

rohansinghrawat's avatar

@automica sir i have my config file

$config['base_url'] = 'https://www.xxxxxxxxxx.com/resort/';

and if i skip this my localhost does not run

and according to you clear cache please could you help me that as i dont know how to clear cache and env in codeigniter quite new in that ..

Sinnbeck's avatar

@rohansinghrawat Have you tried asking the codeigniter community? While some might use codeigniter3 here, I am sure its very few. This is a laravel based community, so most of peoples knowledge here is based around that.

Regarding cache, then that was most likely in reference to how laravel works.

1 like
rohansinghrawat's avatar

@Sinnbeck yes sir but according to my error ... this error is more related to some nginx stufff as I have same project on my windows machine and on that machine there is no any error related to this .. so I thought might be any hint would help me

1 like

Please or to participate in this conversation.