codeigniter&的多个站点杂货店

时间:2013-09-19 08:17:32

标签: .htaccess codeigniter

尝试将这两个程序用于多个站点但失败了 codeigniter 2.1.4
杂货店crud 1.4.1

文件夹结构

c:/server/ci/application/site1/config  
c:/server/ci/application/site1/controller  
...  
c:/server/ci/application/site2/config  
c:/server/ci/application/site2/controller  
...  
c:/server/ci/system  
c:/server/www/assets/  (grocery crud)    
c:/server/www/index.php  (pointing to site 1)  
c:/server/www/site2.php  (pointing to site 2)  
c:/server/www/.htaccess  

请注意,网站1& 2现在使用相同的“assets”文件夹。

htaccess的详情

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

当我使用网站2时,网址必须始终需要/localhost/site2.php/welcome/employees 如何从网址中删除“site2.php”? 我尝试将此添加到htaccess但不起作用:

RewriteRule ^$ site2.php [L]    

或者我使用错误的文件夹结构?

解决方案:
我改变了我的文件夹结构:
    C:/服务器/ CI /应用/ site1的/配置
    C:/服务器/ CI /应用/ SITE1 /控制器
    ...
    C:/服务器/ CI /应用/站点2 /配置
    C:/服务器/ CI /应用/站点2 /控制器
    ...
    C:/服务器/ CI /系统
    c:/ server / www / site1 / assets /(杂货店crud)

c:/server/www/site1/index.php  (pointing to site 1)  

编辑索引文件:
    $ system_path ='../../ci/system';
    $ application_folder ='../../ci/application/site1';

c:/server/www/site1/htaccess  

编辑htaccess
RewriteBase / site1

c:/server/www/site2/assets/  (grocery crud)  
c:/server/www/site2/index.php  (pointing to site 2)  

编辑索引文件:
    $ system_path ='../../ci/system';
    $ application_folder ='../../ci/application/site2';

c:/server/www/site2/htaccess  

编辑htaccess
RewriteBase / site2

两个站点的url上的index.php都没有问题 但是等等,这个“资产”文件夹是不是重复了? 所以我将assets文件夹移到root

c:/server/www/assets/  (grocery crud)  

c:/server/www/site1/htaccess  
c:/server/www/site1/index.php  (pointing to site 1)  

c:/server/www/site2/htaccess  
c:/server/www/site2/index.php  (pointing to site 2)  

还需要在第3400行的两个站点/libraries/grocery_crud.php上编辑文件
    protected $ default_language_path ='../assets/grocery_crud/languages';
    protected $ default_config_path ='../ assets/grocery_crud / config';
    protected $ default_assets_path ='../ assets/grocery_crud';

希望这些信息对其他人有用,欢呼。

0 个答案:

没有答案