Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home PHP Configure To Run Codeigniter In Sub Folder Or Sub Directory

Configure To Run Codeigniter In Sub Folder Or Sub Directory

To run Codeigniter framework in a sub folder or sub directory of your web root and auto switch the configuration between local environment and live environment, we will need to edit the config.php file (which is located at Codeigniter root/application/config folder) as below:

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|	http://example.com/
|
| If this is not set then CodeIgniter will guess the protocol, domain and
| path to your installation.
|
*/
if($_SERVER["SERVER_ADDR"] == "127.0.0.1")
{
	$config['base_url']	= '';
}
else 
{
	$config['base_url']	= 'http://yourdomain.com/path-to-codeigniter/';
}

/* |-------------------------------------------------------------------------- | Base Site URL |-------------------------------------------------------------------------- | | URL to your CodeIgniter root. Typically this will be your base URL, | WITH a trailing slash: | | http://example.com/ | | If this is not set then CodeIgniter will guess the protocol, domain and | path to your installation. | */ if($_SERVER["SERVER_ADDR"] == "127.0.0.1") { $config['base_url'] = ''; } else { $config['base_url'] = 'http://yourdomain.com/path-to-codeigniter/'; }

Sep 6, 2013Hoan Huynh
file_get_contents() [function.file-get-contents]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0Linux Centos iptables Open Port
You Might Also Like:
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • How To Track Website With Multiple Google Analytisc Accounts
  • PHP check if folder exists then create folder
  • How To Configure Friendly URL For WordPress Hosted On IIS
  • Get Image Width Height With JQuery And JavaScript
  • JavaScript Get Radio Button Value
  • Jquery checkbox checked
  • PHP Copy Entire Directory To Another Directory
  • PHP Completely Delete A Directory Include Sub Directories And Files
  • innerText May Not Work On Mozilla Firefox
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

8 years ago PHPbase_url, Codeigniter, SERVER_ADDR1,326
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,460 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,839 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,656 views
JQuery Allow only numeric characters or only alphabet characters in textbox
14,998 views
C# Read Json From URL And Parse/Deserialize Json
11,723 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development