CodeIgniter Forums
URL redirect not working properly - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: URL redirect not working properly (/showthread.php?tid=4874)



URL redirect not working properly - El Forum - 12-20-2007

[eluser]Unknown[/eluser]
Hi,

Let's say I have a url: www.my-site.com/index.php/admin

I have a simple form which on submit should go to 'clients/add'.

Instead I get something like this: www.my-site.com/index.php/admin/www.my-site.com/index.php/clients/add

I am sure it's a simple amateur problem, but still a problem... Could somebody tell me:

1. why is this request handled this way.
2. how can i fix it.

Thanks! | Sebastian.


URL redirect not working properly - El Forum - 12-20-2007

[eluser]ejangi[/eluser]
in your /application/config/config.php file you need to fill in the:
Code:
$config['base_url'] = 'http://www.mysite.com/';
Option.

But, I think you're main problem is just that you're not putting the 'http://' at the start of your link. Either do a link as:
Code:
<a href="http://www.mysite.com/whatever">Whatever</a>
or use:
Code:
&lt;?php echo anchor('clients/add', 'Add a new client'); ?&gt;
And be sure to fill in the config item mentioned earlier.


URL redirect not working properly - El Forum - 12-20-2007

[eluser]Unknown[/eluser]
ucantblamem : Thanks, I had $config['base_url'] = 'www.mysite.com/' instead of $config['base_url'] = 'http://www.mysite.com/';

That did the trick,

C u around! | Sebastian.