How to make a CodeIgniter project portable with redirects
- by Jono
I would like to set up my codeigniter projects so I can use it in any folder on my webserver. Unfortunately codeigniter requires me to specify the location in several variables of the config. This is a problem for portability.
There are 3 places where I see this:
1) $config['base_url']
2) $config['base_path']
3) .htaccess RewriteRule
So far, I have found the solution to (1) here:
http://codeigniter.com/wiki/Automatic_base_url/
I am looking for solutions to (2) and (3), but most importantly (3). Here is an example situation:
I set .htaccess to have the RewriteRule as follows:
RewriteRule ^(.*)$ /folderA/index.php/$1 [L]
Then I go into my repo and check out the project to another folder to make some separate changes. Now I have to update .htaccess to show the following:
RewriteRule ^(.*)$ /folderB/index.php/$1 [L]
I would like to set it so I dont have to make any config changes when I check out another copy.