Welcome Guest, Not a member yet? Register   Sign In
Automatic config[base_url]
#6

[eluser]phpMaster[/eluser]
[quote author="walesmd" date="1190252421"].... nice addition that has tripped me up many times before.
I've been completely stumped wondering why my app wasn't working properly
only to find it was 17 little characters destroying my life: http://localhost/[/quote]

Hi!
I posted a 'mini article' in another topic, about same issue:
http://ellislab.com/forums/viewreply/297477/

In a bit shorter version:
--------------------------------------------------------------------------

Many many many many softwares have not an intelligent way of setting BASE-URL.
I make 99% of my PHP work and applications admin from http://localhost/
Now, if I set base-url in a software (sometimes even in the database!)
like this: http://localhost/app/
then nobody else but me can use my app.

If I set base-url like this: http://www.mydomain.com/app/
then I can not admin my apps (unless I connect via some proxy server)

This is how I have set config of my CodeIgniter ( and a whole bunch of other less intelligent softwares Smile )
Code:
//| URL to your CodeIgniter root.  WITH a trailing slash:

$config['base_url']    = "http://".$_SERVER['HTTP_HOST']."/codeigniter/";
Adding a couple of more lines, it is even possible to detect if it should be either of:
https:// http:// ... and the phpBB3 developers even auto detect whatever :8080 port number!

This way it will work whatever URL alias is used to visit your site!
yourdomain.com, localhost, 127.0.0.1, 192.168.0.1 etc etc
And if you change your domain name, you wont have to change a thing.
--------------------------------------------------------------------------

Regards - phpMaster


Messages In This Thread
Automatic config[base_url] - by El Forum - 09-05-2007, 08:19 AM
Automatic config[base_url] - by El Forum - 09-05-2007, 08:40 AM
Automatic config[base_url] - by El Forum - 09-19-2007, 10:05 AM
Automatic config[base_url] - by El Forum - 09-19-2007, 02:40 PM
Automatic config[base_url] - by El Forum - 09-19-2007, 07:44 PM
Automatic config[base_url] - by El Forum - 09-20-2007, 06:07 PM
Automatic config[base_url] - by El Forum - 10-09-2007, 07:41 AM
Automatic config[base_url] - by El Forum - 10-25-2007, 03:39 PM
Automatic config[base_url] - by El Forum - 10-27-2007, 07:29 PM
Automatic config[base_url] - by El Forum - 10-27-2007, 11:21 PM
Automatic config[base_url] - by El Forum - 11-04-2007, 10:02 PM
Automatic config[base_url] - by El Forum - 11-06-2007, 04:23 AM
Automatic config[base_url] - by El Forum - 11-25-2007, 08:42 AM
Automatic config[base_url] - by El Forum - 12-06-2007, 02:08 PM
Automatic config[base_url] - by El Forum - 12-06-2007, 04:19 PM
Automatic config[base_url] - by El Forum - 12-06-2007, 04:29 PM
Automatic config[base_url] - by El Forum - 12-06-2007, 04:58 PM
Automatic config[base_url] - by El Forum - 12-07-2007, 02:46 AM
Automatic config[base_url] - by El Forum - 03-18-2008, 11:38 AM
Automatic config[base_url] - by El Forum - 03-18-2008, 11:51 AM
Automatic config[base_url] - by El Forum - 03-18-2008, 11:53 AM
Automatic config[base_url] - by El Forum - 03-18-2008, 11:54 AM
Automatic config[base_url] - by El Forum - 03-18-2008, 12:49 PM
Automatic config[base_url] - by El Forum - 03-21-2008, 12:19 PM
Automatic config[base_url] - by El Forum - 03-21-2008, 01:33 PM
Automatic config[base_url] - by El Forum - 04-08-2008, 11:10 PM
Automatic config[base_url] - by El Forum - 04-09-2008, 08:44 AM
Automatic config[base_url] - by El Forum - 04-22-2008, 10:56 AM
Automatic config[base_url] - by El Forum - 04-23-2008, 04:07 AM
Automatic config[base_url] - by El Forum - 04-23-2008, 04:14 AM
Automatic config[base_url] - by El Forum - 04-23-2008, 08:06 PM
Automatic config[base_url] - by El Forum - 04-23-2008, 08:21 PM
Automatic config[base_url] - by El Forum - 04-23-2008, 09:00 PM
Automatic config[base_url] - by El Forum - 04-24-2008, 11:09 AM
Automatic config[base_url] - by El Forum - 04-24-2008, 01:19 PM
Automatic config[base_url] - by El Forum - 04-24-2008, 10:50 PM
Automatic config[base_url] - by El Forum - 04-25-2008, 12:53 AM
Automatic config[base_url] - by El Forum - 04-25-2008, 08:21 PM
Automatic config[base_url] - by El Forum - 05-02-2008, 10:26 AM
Automatic config[base_url] - by El Forum - 05-04-2008, 02:36 AM
Automatic config[base_url] - by El Forum - 08-08-2008, 12:07 PM
Automatic config[base_url] - by El Forum - 10-07-2008, 03:28 AM
Automatic config[base_url] - by El Forum - 10-07-2008, 05:08 AM
Automatic config[base_url] - by El Forum - 07-01-2009, 01:06 AM
Automatic config[base_url] - by El Forum - 09-25-2009, 11:07 AM
Automatic config[base_url] - by El Forum - 09-25-2009, 12:00 PM
Automatic config[base_url] - by El Forum - 09-25-2009, 12:56 PM
Automatic config[base_url] - by El Forum - 09-25-2009, 01:51 PM
Automatic config[base_url] - by El Forum - 09-25-2009, 02:20 PM
Automatic config[base_url] - by El Forum - 09-25-2009, 02:23 PM
Automatic config[base_url] - by El Forum - 09-25-2009, 02:33 PM
Automatic config[base_url] - by El Forum - 09-25-2009, 03:07 PM
Automatic config[base_url] - by El Forum - 09-25-2009, 05:05 PM
Automatic config[base_url] - by El Forum - 09-26-2009, 04:18 AM
Automatic config[base_url] - by El Forum - 09-28-2009, 03:58 AM
Automatic config[base_url] - by El Forum - 11-21-2010, 11:10 PM
Automatic config[base_url] - by El Forum - 05-11-2011, 09:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB