CodeIgniter Forums
CodeIgniter in Subdirectories Using .htaccess - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: CodeIgniter in Subdirectories Using .htaccess (/showthread.php?tid=447)



CodeIgniter in Subdirectories Using .htaccess - EpicKris - 12-05-2014

Hello!

I have a CodeIgniter installation which I want to 'duplicate' into 2 subdirectories so example.com, example.com/subdirectory1, and example.com/subdirectory2 all use the same CodeIgniter installation and work exactly the same when accessing the controllers, etc…

This is my current .htaccess file:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond $1 !^(index\.php|images|favicon\.ico|robots\.txt|resources|docs|media)
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

<IfModule mod_mime.c>
    AddType application/x-apple-aspen-config .mobileconfig
</IfModule>



RE: CodeIgniter in Subdirectories Using .htaccess - John_Betong - 12-05-2014

I backup projects like this:

1. copy the complete project into a sub_domain_root/whatever directory
2. copy this .htaccess into your sub_domain_root
DirectoryIndex index.php index.html

RewriteEngine on
# MAYBE adjust the following to your own paths
# RewriteCond $1 !^(index\.php|images|css|robots\.txt|favicon\.ico|Sitemap\.xml|sitemap\.xml)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]

3. copy your index.php into your sub_domain_root AND adjust paths

Demo:
http://test-007.anetizer.com/


RE: CodeIgniter in Subdirectories Using .htaccess - trentramseyer - 12-06-2014

(12-05-2014, 04:15 PM)EpicKris Wrote: I have a CodeIgniter installation which I want to 'duplicate' into 2 subdirectories so example.com, example.com/subdirectory1, and example.com/subdirectory2 all use the same CodeIgniter installation and work exactly the same when accessing the controllers, etc…

If they are running the same install, what are the directories representing? Site A, Site B, Site C?

What dynamically is supposed to change?