Managing your Applications

By default it is assumed that you only intend to use revIgniter to manage one application, which you will build in your application/ directory. It is possible, however, to have multiple sets of applications that share a single revIgniter installation, or even to rename or relocate your application folder and / or your system folder.

Renaming the Application Folder

If you would like to rename your application folder you may do so as long as you open your main index.lc file and set its name using the gRigA["applicationFolder"] variable:

put "application" into gRigA["applicationFolder"]

Relocating your Application Folder

It is possible to move your application folder to a different location on your server than your root folder. To do so open your main index.lc and set a full server path in the gRigA["applicationFolder"] variable. You may use a relative path as long as your application folder is in the root folder or below.

put "/Path/to/your/application" into gRigA["applicationFolder"]

If you just like to move the application folder to the system folder you do not need to modify index.lc at all.

Renaming the System Folder

Similar to the way to rename the application folder described above you may rename your system folder as long as you open your main index.lc file and set its name using the gRigA["systemFolder"] variable:

put "system" into gRigA["systemFolder"]

Relocating your System Folder

To move your system folder to a different location on your server than your root folder open your main index.lc and set a full server path in the gRigA["systemFolder"] variable. You may use a relative path as long as your application folder is in the root folder or below.

put "/Path/to/your/system" into gRigA["systemFolder"]

Note:  The path to your application folder or system folder must use Unix style directory separators. Do not add a trailing slash.

Running Multiple Applications with one revIgniter Installation

If you would like to share a common revIgniter installation to manage several different applications simply put all of the directories located inside your application folder into their own sub-folder.

For example, let's say you want to create two applications, "foo" and "bar". You will structure your application folder like this:

application/foo/
application/foo/cache/
application/foo/config/
application/foo/controllers/
application/foo/db/
application/foo/errors/
application/foo/extensions/
application/foo/helpers/
application/foo/hooks/
application/foo/index.html
application/foo/language/
application/foo/libraries/
application/foo/logs/
application/foo/models/
application/foo/modules/
application/foo/stacks/
application/foo/views/
application/bar/
application/bar/cache/
application/bar/config/
application/bar/controllers/
application/bar/db/
application/bar/errors/
application/bar/extensions/
application/bar/helpers/
application/bar/hooks/
application/bar/index.html
application/bar/language/
application/bar/libraries/
application/bar/logs/
application/bar/models/
application/bar/modules/
application/bar/stacks/
application/bar/views/

To select a particular application for use requires that you open your main front controller, the index.lc file, and set the gRigA["applicationFolder"] variable. For example, to select the "foo" application for use you would do this:

put "application/foo" into gRigA["applicationFolder"]

To set the gRigA["applicationFolder"] variable for the "bar" application you need another front controller located at document root. Let's name it bar.lc. The corresponding setting should read like this:

put "application/bar" into gRigA["applicationFolder"]

Note:  Each of your applications will need its own index.lc file which calls the desired application. The index.lc file can be named anything you want.

To exclude index.lc and bar.lc from your URLs you need to modify the mod_rewrite rules explained in revIgniter URLs like this:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.lc|bar\.lc|image|img|assets|robots\.txt|css|js|bar)
RewriteRule ^(.*)$ index.lc?/$1 [L]

RewriteCond $1 !^(bar\.lc|index\.lc|image|img|assets|robots\.txt|css|js)
RewriteRule ^bar/?$ bar.lc?/ [L]
RewriteRule ^(bar)/(.*)$ bar.lc?/$2 [L]
</IfModule>

Now, assuming the name of your default controllers is "welcome.lc", the URLs of your applications look like this:

http://www.MyDomain.com/ refers to http://www.MyDomain.com/index.lc/welcome.lc
http://www.MyDomain.com/bar/ refers to http://www.MyDomain.com/bar.lc/welcome.lc