How to solve base_url () problem in my project with codeigniter?

0

Greetings. I'm using codeignite framework everything works well with the base_url (), the problem is that when I log in from another network device while accessing the main window does not access the drivers! or anything that uses base_url (). this is my configuration $ config ['base_url'] = ' link ';

In my view I use it like this <form method="post" action="<?php base_url()?>cindex/login"> <input type="txt" name="name" > <input type="password" name="password"> <button type="submit">enviar</button> </form>

And on my computer the problem is normal when I access from another network machine

I connect to the server with the ip 192.168.10.5 link and normal load but when I sent the form I get an error designing that I do not have access to the address // localhost / Lighting / as you will see when using base_url () as it has the value of // localhost / Lighting / which makes me look for that url on my client machine which causes the error. and that happens where the base_url () foot. and this project has to work in a network !! and I do not know what I can do to prevent that from happening, thanks in advance!

    
asked by nando 08.08.2017 в 21:19
source

1 answer

3

what happens is that localhost only exists on your computer, that's why it's localhost, from other computers and phones you can not use localhost because that url does not exist uses the following better, that I use it too and it works perfect:

$config['base_url'] = 'http://'.$_SERVER["SERVER_NAME"].'/Alumbrado/'

$ _ SERVER ["SERVER_NAME"]

this works to capture the name of the server (domain) you are currently in

    
answered by 08.08.2017 / 21:49
source