我正在使用codeigniter。这真让我感到沮丧。我试图删除这个index.php的东西。当我在本地服务器(localhost)中运行我的代码时,它运行良好。它加载我的所有CSS和JS。现在申请在线[http://www.socialfansmafia.com] [1]
[1]:http://www.socialfansmafia.com。你可以看看。它会要求您使用Twitter登录。别担心,这不是一个骗局。我正在使用elliot houghin twitter库。
我的css和JS都没有加载。请帮帮我们。我在接下来的4个小时内做了一个演讲: - (
这是我的.htaccess:
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
我在配置文件中设置了$config['index_page'] = '';
,并且所有这些代码都在localhost中运行成功..但它不能在Online服务器上运行...任何建议人员?最好的问候 - alfin
答案 0 :(得分:2)
我用:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1 [L,PT]
答案 1 :(得分:1)
您需要更改.htaccess以允许css和js文件夹:
# just add css|js to the RewriteCond
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|robots\.txt|css|js) #update this line
RewriteRule ^(.*)$ /index.php/$1 [L]
这告诉apache允许Web访问css
和js
文件夹中的文件。否则,它会将这些请求路由到index.php文件(只发出404)。