php - CodeIgniter in Sub-directory gives 404 error, when CodeIgniter is installed in / root folder also -
i have site created using codeigniter, , application installed on web root (/). shared hosting environment on godaddy. creating development environment, copied same , created /development folder in / root.
now, main site works well, when try use link on sub-directory (linked different domain name), giving me 404 error.
i have tried solution given on stackoverflow, not work.
duplicate of: codeigniter won't run in subdirectory
so structure is:
/system /application1 /index.php /.htaccess /development/application2 /development/index.php /development/.htaccess
the top level .htaccess contains:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ index.php?/$1 [l] rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ index.php/$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l] </ifmodule>
the sub-directory .htaccess is:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase /development/ rewritecond %{request_uri} ^system.* rewriterule ^(.*)$ index.php?/$1 [l] rewritecond %{request_uri} ^application.* rewriterule ^(.*)$ index.php?/$1 [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php?/$1 [l] </ifmodule> <ifmodule !mod_rewrite.c> errordocument 404 index.php </ifmodule>
(i have tried suggestions given on stackoverflow add ./ in front of index.php files, , suggestions provided in other ticket)
the $system_path in sub-directory points top level /system folder, avoid conflicts.
the main page displays correctly on site, & main page of sub-domain, created as:
http://www.mysite.co/ http://development.mysite.co/
but links sub-domain created show 404 error , have not been able of links working.
i hosting on shared server (linux) on godaddy , have php 5.3 installed. main root @ location (absolute path): /home/content/22/88885555/html
and sub-directory have created @ (absolute path): /home/content/22/88885555/html/development
i have used paths as:
/ /development/
does have knowledge of or has experimented such setup?
within /index.php modify following lines:
$system_path = "/path/to/your/public_html/system"; $application_folder = "/path/to/your/public_html/application1";
now edit /application1/config/config.php
find following lines , change domain name.
$config['base_url'] = 'http://mysite.co'; $config['index_page'] = '';
open /.htaccess , amend following:
<ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewritecond %{http_host} mysite.co rewritecond $1 !^(index\.php|development) rewriterule ^(.*)$ /index.php/$1 [l] rewritecond %{http_host} development.mysite.co rewritecond %{request_uri} !development/ rewriterule ^(.*)$ development/index.php/$1 [l]
now sub directory application.
open /development/index.php
amend following lines match setup:
$system_path = "/path/to/your/public_html/system"; $application_folder = "/path/to/your/public_html/development/application2";
notice system_path same application1?
modify config file of application2. open /development/application2/config/config.php , amend base url test site.
$config['base_url'] = 'http://development.mysite.co';
finally remove, /development/.htaccess.
Comments
Post a Comment