Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter in Subdirectories Using .htaccess
#1

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>
Kristian Matthews-Kennington
Apple Certified Associate Mac Integration & Management 10.10
Reply
#2

(This post was last modified: 12-05-2014, 09:17 PM by John_Betong. Edit Reason: added sub_domain_root )

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/
Reply
#3

(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?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB