【发布时间】:2016-05-21 06:01:18
【问题描述】:
我在一个用 codeigniter 开发的网站工作, 要从 url 中删除 index.php,我在 htaccess 中编写了重写规则,现在,还有一个需要出现,即我需要将 url 中的 http:// 替换为 www,为此我编写了代码
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} ^vrinfosystem.com$
RewriteRule (.*) http://www.vrinfosystem.com/$1 [R=301,L]
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
但我遇到了问题,找不到样式表和 js。
我也更改了基本网址,但没有帮助。
如果我在HTTP_HOST 上方写下以下行
RewriteRule ^(.*)$ index.php?/$1 [L]
它会正常工作,但 index.php 将保留在 url 中。
我能解决这个问题吗?
【问题讨论】:
-
应该只有一个[L],下面的其他规则将被省略。
标签: php .htaccess codeigniter