How to set proper base url? |
[eluser]peekk[/eluser]
Hello, when I had my site on development environment - it was url: Code: testurl.com Now on production server my codeigniter app's address has to be Code: someurl.com/mysite/ I moved it there, and everytime I'm trying to run some function, example Code: /home/test Code: someurl.com/home/test It has to be Code: someurl.com/mysite/home/test Code: $config['base_url'] = someurl.com/mysite/
[eluser]Paulo Carvalho [/eluser]
Move your whole application to mysite folder inside your root space?.
[eluser]NeoArc[/eluser]
Use the HTML <base> tag, and relative paths to your application: Code: <head>
[eluser]Hampti[/eluser]
Hi there, you can set base_url manually via config as you already stated. Bad if you use different subdirectories in development and production environment. My solution for this nuisance is as follows: In config.php where $config['base_url'] is set: Code: // determine protocol - needed if you run http and https Works fine for me, hope it helps Best Regards Constantin
[eluser]NeoArc[/eluser]
That's a good solution. Also, Codeigniter 2.1 autodetects the base url if the configuration value is empty. $config['base_url'] = "";
[eluser]Aken[/eluser]
And since no one actually answered the question directly, the correct base_url format is a full URL to the directory where your index.php file is, including http and a trailing slash (as is properly documented in the comments directly above the config setting - READ). In your production case, it would be http://someurl.com/mysite/ |
Welcome Guest, Not a member yet? Register Sign In |