2015-03-25 39 views
0

我已将我的项目添加到免费托管的000webhost中,我的所有文件都列在public_html /目录中。 项目是在codeigniter中构建的。 我在加入htaccess文件的public_html /的.htaccess包含我的.htaccess文件不起作用

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

但这不工作对我来说是有htaccess的任何问题?

+0

like this one RewriteRule ^(。*)/index.php?req=$1 [L,PT]? – 2015-03-25 07:44:35

+0

您的.htaccess文件很好。你会得到什么错误信息?你有权访问Web服务器的错误日志吗? – vim 2015-03-25 07:44:42

+0

没有我的js,css文件没有被加载,并且链接不工作 – 2015-03-25 07:45:43

回答

2

我用这个(我的作品在这两种,本地和远程):

DirectoryIndex index.php 

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^(index\.php|public|images|css|js|robots\.txt) 

RewriteRule ^(.*)$ index.php?/$1 [L] 

你需要创建一个在CSS,JS等根rolder和子文件夹名为“公共”文件夹

+0

默认情况下,CodeIgniter在每个文件夹中都有一个'index.html'文件。大多数情况下,第一条指令应该指向那条指令。 'DirectoryIndex index.html' – Tpojka 2015-03-25 12:54:55

0

对不起,从我所有的htaccess都没问题,但我在我的基地网址有一个额外的字符,这是造成问题。 对不起。