我的.htaccess文件无效

时间:2015-03-25 07:39:22

标签: php codeigniter web-hosting

我在免费托管000webhost上添加了我的项目,我的所有文件都列在public_html /目录中。 项目是在codeigniter中构建的。 我在public_html / .htaccess中添加了包含

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

但这对我不起作用htaccess有什么问题吗?

2 个答案:

答案 0 :(得分: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]

您需要创建一个名为" public"的文件夹。在根rolder和css,js等的子文件夹中。

答案 1 :(得分:0)

很抱歉,我的所有htaccess都可以,但我的基本网址中有一个额外的字符,这导致了问题。 对不起。