CodeIgniter Forums

Full Version: Using CodeIgniter to support an 'application' under an existing site
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Kenneth Allen[/eluser]
If I have an existing web site, manually developed in PHP with no actual framework, could I create an application using CodeIgniter and store it under the existing site directory structure and invoke it via a link from the existing site?

For example, I have developed a web site for my local Little League using PHP for some basic dynamic content. I want to create an application to support the management of an interlock schedule that permits team representatives to input their own game results. I have a "version 1" implementation written in PHP without the benefit of a framework, and I am preparing to rewrite that using a framework, and CodeIgniter seems to be a good option. Currently I simply add a link to an existing page that invokes a main page from a subfolder that contains the interlock application, and the code works fine.

I would like to do something similar with the new version written in CodeIgniter: install the application in a subfolder and add a link to invoke it, but from then on the interlock application works from the subfolder. I guess the most significant issue is that the base URL for the interlock could then be something like www.mymainsite.com/interlock/ and I am not certain if that can be configured easily (or at all).

El Forum

[eluser]gtech[/eluser]
CI can easily live in subfolders.. everything is accessed from the index.php in the root directory of the CI folder. If you move everything into a subfolder, including the index.php it will work so long as you update the baseurl in ../system/application/config/config.php

so in your example you can rename the CI folder to interlock.. and copy it into your webserver path and you can access it through the webbrowser as follows.

http://<machine ip>/interlock/index.php/<controller>/<function>/<param>

Then you would change the baseurl in config.php

Code:
$config['base_url']    = "http://<machine ip>/interlock";
obviously changing whats inbetween the <> brackets.

you can have as many CI installations as you want in the webserver path, as long as the base url is updated in every subfolder.

does that answer your question, or have I minsunderstood what you are asking?

El Forum

[eluser]Kenneth Allen[/eluser]
gtech,

Thank you. That is exactly the information I was looking for -- and the answer I was hoping for as well.

El Forum

[eluser]gtech[/eluser]
cool

El Forum

[eluser]solconnection[/eluser]
sorry to resuscitate an old thread, but i have a similar question.

I am doing the exact same thing and currently have CI residing in a subfolder called 'dynamic' off my main site.

so i get urls like:
mysite.com/dynamic/index.php/portfolio

mysite.com/dynamic/index.php/login

etc..

anyone have any idea how i can remove the /dynamic/index.php portion from the url and get it to appear as if its sitting in the site root.
ie.
mysite.com/portfolio

mysite.com/login

I have seen many mode_rewrite guides on how to remove index.php but nothing that specifically looks at removing the subfolder as well.

thanks in advance Smile
-D