Welcome Guest, Not a member yet? Register   Sign In
multiple IPs, one codebase - how I did it
#1

[eluser]dcheslow[/eluser]
I have a client who wants 3 different IP addresses (3 different domains) all using the same database and codebase. The database part is easy, but using one codebase is a bit tougher. I looked at using .htaccess, but it got too complicated for my tiny brain.

The solution was easy with codeigniter.

First, all three sites need to be physically on the same server (share a common root directory). This is typically the case in a VPS scenario.

Designate one IP address/site as 'main' and upload the code there.

Copy index.php to each of the other public_html directories. Edit these index.php files, changing the paths to 'system' and 'application'... use the full path (e.g. /home/user_a/public_html/system )

SSH into your server as root and create a symbolic link from public_html/application to the application directory of the main site for each of the other sites. This symlink allows URLs for images/js/css to resolve to the correct location on the main site.

example:

ln -s /home/user_main/public_html/application /home/user_A/public_html/application

You're done.

Your code can easily determine which site is being accessed by interrogating the URL.

enjoy,

=dave=




Theme © iAndrew 2016 - Forum software by © MyBB