• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter with Multiple Sites

#11
in htaccess I'm write

DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA]
RewriteRule ^(.*)$ ./subdomains/accounts/index.php?/$1 [L,QSA]
Reply

#12
it shows this message

Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php
Reply

#13
Hi,

The htaccess file should be in the same folder as the index.php
You don't need the last rule: RewriteRule ^(.*)$ ./subdomains/accounts/index.php?/$1 [L,QSA]
The error message is clear you have not set the path for system folder correctly in index.php
it has to be relative to your index file
so if the system folder is in the "public_html" folder your system path should like something like this:
$system_path = '../../system';
A good decision is based on knowledge and not on numbers. - Plato

Reply

#14
already changed the system path

$system_path = '../../system';
$application_folder = '';

subdomains/accounts
subdomains/accounts/index.php
subdomains/accounts/.htaccess
subdomains/accounts/controllers
subdomains/accounts/views
subdomains/accounts/models
subdomains/accounts/config


I'm using this way but it shows the error

and in Public html


index.php // $system_path & $application_folder not changed bec it calls application
application //for main domain
subdomains // for all sub domains
system
.htaccess
"
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L,QSA] "


I know I'm doing 1 mistake but i can't understand where
Reply

#15
after some other changes it shows error

Warning: require_once(/home/cmihub/public_html/system//config/constants.php): failed to open stream: No such file or directory in /home/cmihub/public_html/system/core/CodeIgniter.php on line 70

Fatal error: require_once(): Failed opening required '/home/cmihub/public_html/system//config/constants.php' (include_path='.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php') in /home/cmihub/public_html/system/core/CodeIgniter.php on line 70
Reply

#16
Is the last error is for the main application ?

What is the  complete folder structure for each application?
You should have your Ci system and applications above the root folder for better security.

So lets take this as your root folder /home/cmihub/public_html/

to keep it nice and tidy

/home/cmihub/ci  <- all CodeIgniter files
/home/cmihub/ci/system  <- CodeIgniter system folder & sub-folder
/home/cmihub/ci/main  <- Copy of CodeIgniter application folder for the main application
/home/cmihub/ci/accounts  <- Another copy of CodeIgniter application folder for the sub-domain application

/home/cmihub/public_html/  <- index.php and htaccess for main application

PHP Code:
$system_path '../ci/system';
$application_folder '../ci/main'


/home/cmihub/public_html/subdomains/accounts  <- index.php and htaccess for accounts application

PHP Code:
$system_path '../../../ci/system';
$application_folder '../../../ci/accounts'

The htaccess can be the same for both domain

with this you should be able to access your applications with

http://www.domain.com/   <- Main application
http://accounts.domain.com/  <- Accounts application

providing the sub-domain has been set up for accounts it should work.

If the sub-domain does not work access it with the folder
http://www.domain.com/subdomains/accounts
A good decision is based on knowledge and not on numbers. - Plato

Reply

#17
yes its working thanks sir...
actually I have no words to say you thanks.

Smile
Reply

#18
Great, you are welcome
A good decision is based on knowledge and not on numbers. - Plato

Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.