在共享HostGator服务器上安装多个CodeIgniter时出现问题

时间:2010-10-01 01:16:03

标签: regex mod-rewrite codeigniter shared-hosting

我与HostGator和多个CI安装共享主机方案。对于每次安装,我都能够从URL中成功删除“index.php”,但在我的插件域中,我的CSS,JS或图像文件都没有正确加载。

以下是我在主域上进行mod重写的内容:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

对于我的插件域,我有这个:

RewriteEngine On
DirectoryIndex index.php
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

附加域位于/public_html/domain.com /.

我无法修改任何不能给我内部服务器错误500的内容。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

这是我如何设置它以避免由于重写而导致css无法加载。希望它有所帮助。

在CI的文档根目录中添加一个名为assets的文件夹。它是系统文件夹所在的文件夹。将所有脚本,CSS,图像等放在assets文件夹中。

Folders:
    >CI Root
    >>assets
    >>>CSS
    >>>Scripts
    >>>Images

然后允许资产请求绕过.htaccess文件中的index.php:

    RewriteEngine on 
    RewriteCond $1 !^(index\.php|images|assets|robots\.txt) 
    RewriteRule ^(.*)$ /index.php/$1 [L]
相关问题